how to program a program to calculate the area and the perimetre of a circle?
pls answer me asap i need to know quickly
thank you!
how to program a program to calculate the area and the perimetre of a circle?
pls answer me asap i need to know quickly
thank you!
how to program a program to calculate the area and the perimetre of a circle?
pls answer me asap i need to know quickly
thank you!
Then you better start showing some effort ASAP. Post your code and any problems you are facing.
main()
{
int rad, mypi=3.14;
int area, perimeter;
cout<<"radian";
cin>>rad;
cout<<"mypi=3.14";
cin>>mypi=3.14;
perimeter=(2*mypi=3.14*rad);
area=mypi=3.14*rad*rad
cout<<"the perimeter is: <<perm<<endl;
cout<<"the area is: <<area<<endl;
}
so i don't know what's wrong,, also i don't know if i have to write "float mypi=3.14 at th beginnig or not
thank you
The formula for calculating the area of a circle is pi*(radius*radius).
You can declare pi as a const double and set it equal to 3.14. So you need to have a variable for radius. Then simply put all the values into the formula.
Also use code tags when posting code.