Help me in c++, | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me in c++,

so in this code it actually gives me value by rounding but I don't want to get rounded number https://code.sololearn.com/cmt0snjUG0JD/?ref=app

13th Jun 2018, 7:29 AM
Bahubali
Bahubali - avatar
6 Answers
+ 1
thank u so much for u r time
13th Jun 2018, 10:00 AM
Bahubali
Bahubali - avatar
0
it should give 1.857142 but it gives 1.857143 actual value is 1.857142857142857
13th Jun 2018, 8:10 AM
Bahubali
Bahubali - avatar
0
i want number upto 6 decimal places without rounding off.how would i do that? is there any method?
13th Jun 2018, 8:35 AM
Bahubali
Bahubali - avatar
0
int a=13; double t; t=int(a*1000000/double(7)); t=t/double(1000000); cout<<t; this printing 1.85714 only
13th Jun 2018, 9:06 AM
Bahubali
Bahubali - avatar
0
I think there is no difference between the above 2 code and they are printing 1.85714 only maybe I am wrong
13th Jun 2018, 9:25 AM
Bahubali
Bahubali - avatar
0
can u please post the full code?
13th Jun 2018, 9:36 AM
Bahubali
Bahubali - avatar