ASCII Progress Bar - Easy Problems - Solution to Toph.co Online Judge Problem

ASCII Progress Bar

Limits 1s, 512 MB

In this problem, you need to write a code that prints an ASCII progress bar. In each test case, you will be given a floating point number representing the percentage.
Here is an example progress bar showing 60%:
[++++++....]
Given the percentage in floating point, floor it down to the nearest 10 (62 becomes 60, 65 becomes 60, 68 becomes 60 and so on.).

Input

The input will contain a single floating point number P (0.0 ≤ P ≤ 100.0).

Output

Print the ASCII progress bar followed by the progress percentage floored to the nearest integer.

#include<stdio.h>
#include<math.h>

int main()
{

    double a;
    scanf("%lf",&a);
    int i;

       a=floor(a);

    printf("[");
    for(i=0;i<((int)a/10);i++)
        printf("+");
    for(i=0;i<10-(a/10);i++)
        printf(".");

    printf("] ");

    printf("%d%c",(int)a,37);

}