how to print numbers with only 2 digits after decimal point in c++
#include <cstdio>
#include <iostream>
int main() {
double total;
cin>>total;
printf("%.2f\n", total);
//one can use the C function to print the decimal points
}
how to print numbers with only 2 digits after decimal point in c++
#include <cstdio>
#include <iostream>
int main() {
double total;
cin>>total;
printf("%.2f\n", total);
//one can use the C function to print the decimal points
}
how to print numbers with only 2 digits after decimal point in c++
#include <iostream>
#include <iomanip>
#include <iostream>
int main()
{
double d = 122.345;
cout << fixed << setprecision(2) << d;
//the setprecision can vary as per required
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us