the data-type ‘float’ displays decimal numbers. by default my compiler displays up-to 6 decimals. i want to see only two decimals. for eg , when the compiler performs the operation “c=2/3”
it displays “0.666666667”. i want to see only “0.67” in my output screen.
so what necessary changes should i make in the C program?
the data-type ‘float’ displays decimal numbers. by default my compiler displays up-to 6 decimals.
Share
You can use a format specifier to limit it to 2 decimal places when outputting the number using
printf.Here’s the output: