This C++ program calculates the area of a circle based on user input radius. It asks the user to enter the radius in cm, then calculates the area in both sq cm and sq m. The user is prompted to choose output in sq m, sq cm, or both. The appropriate area is then displayed based on the radius and units chosen.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
39 views2 pages
Aim: To Evaluate The Area of A Circle.
This C++ program calculates the area of a circle based on user input radius. It asks the user to enter the radius in cm, then calculates the area in both sq cm and sq m. The user is prompted to choose output in sq m, sq cm, or both. The appropriate area is then displayed based on the radius and units chosen.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2
DATE: 30.7.
12
ROLL NO.: 1653
/*Aim: TO EVALUATE THE AREA OF A CIRCLE.*/
#include<iostream.h> #include<conio.h> void main() { clrscr(); int x; float R,r,A,a,pi=3.14; cout<<"\n\t\t PROGRAM TO CALCULATE THE AREA OF A CIRCLE"; cout<<"\n_______________________________________________________________ _________________"; cout<<"\n\nEnter radius of circle in cm: "; cin>>r; R=r/100; a=pi*r*r; A=a/10000; cout<<"\nCalculate the area of circle in:\n"; cout<<"\n1. sq. metre"; cout<<"\n2. sq. cm"; cout<<"\n3. Both"; cout<<"\n\nChoose option: "; cin>>x; if(x==1) { cout<<"\nThe area of the sphere of radius "<<R<<"m is: "<<A<<" sq. m"; } else if(x==2) { cout<<"\nThe area of the sphere of radius "<<r<<"cm is: "<<a<<" sq. cm"; } else { cout<<"\nThe area of the sphere of radius "<<r<<"cm is: "<<a<<" sq. cm\n"; cout<<"\nThe area of the sphere of radius "<<R<<"m is: "<<A<<" sq. m"; } getch(); }