How to display decimal points number in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to display decimal points number in c++

2nd Jun 2019, 10:59 AM
kajamohan
kajamohan - avatar
2 Answers
+ 18
For displaying floating point numbers tou can directly use float pi =3.141; cout << pi; But if you want to display floating point numbers till a specific limit then, you can use the C++manipulator precision which defines the minimum precision. You can refer the below code for more detail : https://code.sololearn.com/cdW2GlpEHgZS/?ref=app
2nd Jun 2019, 11:05 AM
Nova
Nova - avatar
0
A=3,B=5,C=2; Avg=(A+B+C)/3; //i want result is 3.333 cout <<Avg;
2nd Jun 2019, 11:31 AM
kajamohan
kajamohan - avatar