CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Created by Vivek Raj
// for question ref :
//https://www.sololearn.com/Discuss/1784742/?ref=app
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
// include iomanip for setprecision
float a=35.1432;
cout<<fixed;
cout<<setprecision(3)<<a<<endl;
//or your way both works
cout.precision(2);
cout<<fixed<<a;
return 0;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run