Area of various shapes
Write a program in C, which is a Menu-Driven Program to compute the area of the various geometrical shape.
Program
Output
Explanation
Geometrical shapes that are considered are circle, rectangle, triangle and square.
First of all, menu is created and user is asked for his/her choice. Based upon the choice entered, appropriate action is taken using if-else construct. For example, in the above program,
if user enters '1' as his choice then, area of circle is calculated.
if user enters '2' as his choice then, area of rectangle is calculated.
and so on.
First of all, menu is created and user is asked for his/her choice. Based upon the choice entered, appropriate action is taken using if-else construct. For example, in the above program,
if user enters '1' as his choice then, area of circle is calculated.
if user enters '2' as his choice then, area of rectangle is calculated.
and so on.
if(ch == 1)
{
//area of circle
}
else if(ch == 2)
{
//area of rectangle
}
else if(ch == 3)
{
//area of triangle
}
else if(ch == 4)
{
//area of square
}
else
{
printf("Incorrect input");
}