Create a float variable v with value 10.6452348 and display it after rounding it to two decimal numbers.
Answers
Answered by
0
Answer:
10.65
Step-by-step explanation:
Program written and compiled in C++
//In order to read the standard input or output streams.
//The program doesn't compile without this.
#include <iostream>
//This tells the compiler that symbol names defined in the namespace std to be brought into the program's space.
using namespace std;
//This is the entry point of the program.
int main()
{
//A floating variable could be declared by adding float in front
//of variable name.
float v = 10.6452348;
// Directly print the number with .2f precision
//By changing 2 to any other number x i.e., .xf, it prints the
//number with .2x precision.
printf("%.2f", v);
return 0;
}
Similar questions