hi all
output isCode:#include <stdio.h> main() { float i,j=100.0,k=19456.0; i=j/k; printf(******** %f \n",i); }
******** 0.005139803
i would like round figure it like
0.005.
how can i do this
greetings munna
hi all
output isCode:#include <stdio.h> main() { float i,j=100.0,k=19456.0; i=j/k; printf(******** %f \n",i); }
******** 0.005139803
i would like round figure it like
0.005.
how can i do this
greetings munna
You can control the precision by trying something like : "%.af" where 'a' is the number of digits following the decimal point.
In the middle of difficulty, lies opportunity
also you should learn to use int main()
and properly indent your code
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
Looking at your code, I am guessing you must be using a compiler like TC or BC. Please switch over th GCC. It will help you in the long run.
In the middle of difficulty, lies opportunity
Ofcourse it does,
Code:# include<stdio.h> int main() { float i,j=100.0,k=19456.0; i=j/k; printf("******** %.3f \n",i); printf("******** %.5f \n",i); return 0; }
my output:
Code:******** 0.005 ******** 0.00514
In the middle of difficulty, lies opportunity