program to calculate area of circle
following is code for calculating area of circle with user input and without.
- code taking input from user:-
#include<iostream.h>
void main()
{
int r;
float pi,a;
pi=(float)22/7;
cout<<"enter the value of r i.e radius";
cin>>r;
c=pi*r*r'
cout<<"Area of circle is ="<<a;
}
- code without taking input from user:-
#include<iostream.h>
void main()
{
int r;
float pi,a;
pi=(float)22/7;
r=7;
c=pi*r*r;
cout<<"Area of circle is="<<a;
}
note:-it's just a sudo code if its not executing on your device make some changes in the further code this is only for understanding logic.
thankyou for visiting us stay tuned for learning and more intresting u can ask questions in comment section check other blogs for more info. comment mail for compitative cading thankyou.👍😎🙏
0 Comments