Answers for "How to get precision to two decimal places in c"

C
0

How to get precision to two decimal places in c

#include <iostream>
using namespace std;
int main()
{
    float var = 37.66666;
 
    // Directly print the number with .2f precision
    printf("%.2f", var);
    return 0;
}
Posted by: Guest on March-05-2022

Code answers related to "How to get precision to two decimal places in c"

Code answers related to "C"

Browse Popular Code Answers by Language