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

Help!

Yeah, so I have to write a code in which i have to divide (A/B), result needs to have 10 decimals, and first number mustn't be included. For example 7.4/3 is 2.46667 And my result must be like that: 0.4666666667 Any tips and tricks? Ty.

20th Oct 2020, 9:01 AM
Dr. Alien
Dr. Alien - avatar
4 Answers
+ 3
Where is your code/attempt ??
20th Oct 2020, 9:03 AM
Arsenic
Arsenic - avatar
+ 2
use std::setprecision stream manipulator defined in <iomanip> header. https://en.cppreference.com/w/cpp/io/manip/setprecision
20th Oct 2020, 9:26 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 1
i guess there is needed formatting, something like %0.10f here is example but its rather pure C than C++ https://code.sololearn.com/cGk1fDeAd7Qo/#cpp
20th Oct 2020, 9:15 AM
Szwendacz
Szwendacz - avatar
0
That is prefect! Ty for your time!
20th Oct 2020, 9:39 AM
Dr. Alien
Dr. Alien - avatar