wanna divide 2 numbers and get the result like this:
5 / 2 = 2.50
But it only outputs 2.
I don\'t now what i\'m doing wrong.
Here my code:
To avoid the typecast in float you can directly use scanf with %f flag.
float a; float b; float c; printf("First number\n"); scanf("%f", &a); printf("Second number\n"); scanf("%f", &b); c = a / b; printf("%f", c);