how can I use format specifier as asked in this question.
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
double pi = 3.14;
double radius =8.9; //radius has to be declared as a 'double'
double area = pi * radius *radius;
cout << "The Area of the given Circle is "<<area;
return 0;
}
Hello @aman_884 ,
here you need to add the format specifier of double to output the area by using format specifier. So for double data type the format specifier is %lf, so you need to write this:
double pi = 3.14;
double radius =8.9; //radius has to be declared as a ‘double’
double area = pi * radius *radius;
printf(“The Area of the given Circle is: %lf”, area);
return 0;
}
I think this may help you for solving, the further the question.
Thanks