0

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!

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Grn Xtrm
0

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.

0
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

Edited by Dani: Formatting fixed

0

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.

Edited by Grn Xtrm: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.