This is a simple program to find the area of a circle, triangle, square.
Compiler: Turbo C++ 3.0
Author: Naman Kumar
#include<iostream.h>
#include<conio.h>
int main()
{
clrscr();
char ch;
float area;
cout<<"You want area of :-"
<<"\n1.Triangle"
<<"\n2.circle"
<<"\n3.Square";
ch=getch();
switch(ch)
{
case '1':
float base,height;
cout<<"\n\nEnter the Base of triangle : ";
cin>>base;
cout<<"\nEnter the height of triangle : ";
cin>>height;
area=(1.0/2.0)*base*height;
cout<<"\nAREA : "
<<area;
break;
case '2':
float rad;
cout<<"Enter the radius of the circle : ";
cin>>rad;
cout<<"Area : ";
area=3.14*rad*rad;
cout<<area;
break;
case '3':
float side;
cout<<"Enter side of Square : ";
cin>>side;
area=side*side;
cout<<"AREA : "
<<area;
break;
}
getch();
return 0;
}
0 comments:
Post a Comment