Search:

Submit Article

Program to calculate area of rectangle and circle

Posted By: Felipe Reed     Category: C Programming     Views: 33778

Code for Program to calculate area of rectangle and circle in C Programming

```#include<stdio.h>
#include<conio.h>
#include<process.h>

#define pi 3.142857
main()
{
char ans = 'y';
float length, breadth, circumference, arear, perimeter, radius, areac;
clrscr();
do
{
clrscr();
printf("\n    Rectangle    \n");
printf("\nPlease enter length       := ");
scanf("%f", &length);
fflush(stdin);

fflush(stdin);

arear = length * breadth;
printf("\nThe area of rectangle are := %5.3f\n", arear);

printf("\n    Circle        \n");
fflush(stdin);

circumference = 2 * pi * radius;
printf("\nThe circumference of the circle := %f\n", circumference);

areac = (pi * radius) * radius;
printf("\nThe area of the circle          := %f", areac);

printf("\n");
printf("\nEnter any more (Y/N)            := ");
scanf("%c",&ans);
fflush(stdin);
if (ans == 'y' || ans == 'Y')
{
continue;
}
elseif (ans == 'n' || ans == 'N')
{
exit(0);
}
} while (ans == 'y' || ans == 'Y');
getch();
return;
}```
Share:

Didn't find what you were looking for? Find more on Program to calculate area of rectangle and circle Or get search suggestion and latest updates.

 Felipe Reed author of Program to calculate area of rectangle and circle is from Philadelphia, United States. View All Articles

 Please enter your CommentComment should be atleast 30 Characters.Please put code inside [Code] your code [/Code]. No Comment Found, Be the First to post comment!