Sunday, March 17, 2013

Prompt the user for the diameter of a circle in centimeters and find out its area in square meters.

Program Sample Output

 Sample Input: (Note: Bold refers to user input)

Enter Diameter : 200

Sample Output:

Area : 3.142 square meters

CODE

#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
main()
{
      float dia;
      cout<<"Enter Diameter : ";
      cin>>dia;
      dia=dia/2;
      dia=dia/100;
      dia=dia*dia;
      dia=3.142*dia;
      printf("%f",dia);
getche();
}

Download the executable of this project from HERE

No comments:

Post a Comment