+ 1
how to set width of float when user have to input the float value? FOR C LANGUAGE
If i enter 3.14159 in console window but i want the program to give output as 3.14
3 Respostas
+ 3
printf("%5.2f \n", 3.14159);
Please indicate language by adding the tag to your question
Please remove the tags input and output and replace by float as tag
+ 2
You must use printf with %.nf
After point n is number of decimals and f means float. Example for printing three decimals:
float f = 1.23456;
printf("%.3f",f);
+ 1
thank you sir