Q-2: The length and breadth of a rectangle and radius of a circle are input through key board. Write a program to calculate the area and perimeter of the rectangle and the area and the circumference of the circle.
#include<stdio.h>
#include<conio.h>
void main()
{
float len,bre,aor,aoc,por,coc,rad;
clrscr();
printf("\n\t\tENTER THE LENGTH OF THE RECTANLE:");
scanf("%f",&len);
printf("\n\t\tENTER THE BREADTH OF THE RECTANLE:");
scanf("%f",&bre);
printf("\n\t\tENTER THE RADIUS OF THE CIRCLE:");
scanf("%f",&rad);
aor=len*bre;
por=2*(len+bre);
aoc=3.14*rad*rad;
coc=3.14*2*rad;
printf("\n\t\tTHE AREA OF RECTANGLE:%f",aor);
printf("\n\n\t\tTHE PERIMETER OF RECTANGLE:%f",por);
printf("\n\n\t\tTHE AREA OF CIRCLE:%f",aoc);
printf("\n\n\t\tTHE CIRCUMFERENCE OF CIRCLE:%f",coc);
getch();
}
No comments:
Post a Comment