Write a program in 'C' Language to calculate the area and perimeter of thhe rectangle?
Q. The Length and breadth of a rectangle and radius of a circle are input through thhe keyword. Write a program to calculate the area and perimeter of thhe rectangle, and the area and circumference of the circle?
Solve:
#include<stdio.h>
#include<conio.h>
int main()
{
int l,b,r;
int ans;
printf("\n Enter the value of rectangle length: ");
scanf("%d", &l);
printf("\n Enter the value of rectangle Breadth: ");
scanf("%d", &b);
ans=l*b;
printf("\n Area of the rectangle is:=%d",ans);
ans=2*l+2*b;
printf("\n Perimeter of the rectangle:=%d",ans);
printf("\n Enter the radius of circle:");
scanf("%d", &r);
ans=3.14*r*r;
printf("\n Area of the circle:=%d",ans);
ans=2*3.14*r;
printf("\n circumference of the circle:=%d",ans);
}
Program In Dev C++
0 comments:
Post a Comment