The length & breadth of a rectangle and radius of a circle are input through the keyboard. Wriyte a program to calculate the area & perimeter of the rectangle and the area of the circle and circumference.
#include<stdio.h>
#include<conio.h>
main()
{
int b,l,r,area1,perimeter;
float area2,circum;
printf("Enter the lenght & breadth of Rectangle");
scanf("%d%d",&l,&b);
printf("Enter the radius of circle");
scanf("%d",&r);
area1=l*b;
area2=3.14*r*r;
perimeter=2*(l+b);
circum=2*3.14*r;
printf("\n\nThe Area of Rectangle %d",area1);
printf("\n\nThe Perimeter of Rectangle %d",perimeter);
printf("\n\nThe Area of Circle %f",area2);
printf("\n\nThe Circumferance of circle %f",circum);
printf("\n\n\nEnter any key to exit....");
getch();
}
Output:-
#include<stdio.h>
#include<conio.h>
main()
{
int b,l,r,area1,perimeter;
float area2,circum;
printf("Enter the lenght & breadth of Rectangle");
scanf("%d%d",&l,&b);
printf("Enter the radius of circle");
scanf("%d",&r);
area1=l*b;
area2=3.14*r*r;
perimeter=2*(l+b);
circum=2*3.14*r;
printf("\n\nThe Area of Rectangle %d",area1);
printf("\n\nThe Perimeter of Rectangle %d",perimeter);
printf("\n\nThe Area of Circle %f",area2);
printf("\n\nThe Circumferance of circle %f",circum);
printf("\n\n\nEnter any key to exit....");
getch();
}
Output:-
No comments:
Post a Comment