#include<stdio.h> int main() { float i; double j; i=22/7; j=22/7; printf("%f\n%.2f", i,j); return 0; } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

#include<stdio.h> int main() { float i; double j; i=22/7; j=22/7; printf("%f\n%.2f", i,j); return 0; }

Can anyone help me to get the accurate output value after decimal of the code

26th Aug 2021, 9:07 PM
Ritik Kumar
1 Answer
0
Also use %lf for the second argument for printf() <j>, it's of double type.
27th Aug 2021, 1:03 AM
Ipang