+ 1
Can you solve write a program in c++to print area of circle
3 Respostas
+ 2
#include<iostream.h>
#include<conio.h>
main()
{
int r;
float ar;
cout<<"Enter radius : ";
cin>>r;
ar=(22/7.0)*r*r;
cout<<"\nArea of circle = "<<ar;
getch();
}
+ 2
#include<iostream>
using namespace std;
int main()
{
float r , area ;
cin >> r ;
cout << " Radius = " << r ;
area = (22/7.0)*r*r ;
cout << "\n Area = " << area ;
return 0;
}
0
For C++11:
constexpr double pi() {
return std::atan(1) * 4;
}
double circleArea(double radius) {
return pi() * radius * radius;
}