Q.The length and breadth of a
rectangle and radius of a circle are input through the keyboard. Write a
program to calculate the area and perimeter of the rectangle, and the area and
circumference of the circle.
Program:
#include
<stdio.h>
#include<conio.h>
#define
PI 3.1428
void
main()
{
float
r,a,p,l,b,pr,A;
printf(“enter
length and breadth of rectangle=”);
scanf(“%f”&l,&b);
printf(“enter
radius of circle=”);
scanf(“%f”&r);
a=PI*r*r;
p=2*PI*r;
A=l*b;
pr=2*(l+b);
printf(“\nThe area of circle is=%f”, a);
printf(“\nThe perimeter of circle
is=%f,p);
printf(“\nThe area of rectangle is=%f”,A);
printf(“\nThe perimeter of rectangle
is=%f”,pr);
getch();
}
Output:
enter
length and breadth of rectangle= 3,2
enter
radius of circle =7
The
area of circle is=15309972
The
perimeter or circle=43.9992
The
area of rectangle is=6
The
perimeter of rectangle is=10
No comments:
Post a Comment