0
What the complier don't show the ans as 3.15 why it show answer in 8 bit
9 odpowiedzi
+ 2
yes Jamie , correct... .2f is what it is required... My bad... setprecision is for cout.
+ 2
try:
printf("%g\n", PI);
0
Because you are using float data type , answer will be 3.150000.
If you use int data type it will be 3.
Hope this helps ☺️☺️.
0
but meet i also want exponential part and that is 15 thats why i use float data type
0
you need to use setprecision from iomanip header
0
As Jamie said use .2 to print upto two decimal points.
Result => 3.15
Use .3 to print upto 3 decimal points and so on.
0
it depends on what you encode on the system