1#include <iostream>
2#include <cstdio>
3using namespace std;
4
5int main()
6{
7 // This code helps you to print a number with desired decimal
8 double Number=10.3454;
9 printf("%.3lf",Number);
10
11 return 0;
12}
1#include <iostream>
2#include <iomanip>
3using namespace std;
4
5int main()
6{
7 float x=10.3445f;
8
9 cout<<fixed<<setprecision(5)<<x<<endl;
10 cout<<fixed<<setprecision(2)<<x<<endl;
11 cout<<fixed<<setprecision(3)<<x<<endl;
12 cout<<fixed<<setprecision(0)<<x<<endl;
13
14 return 0;
15}
16