program to compare area and perimeter of rectangle
program to compare area and perimeter of rectangle
#include<stdio.h>
void main()
{
int area,pera,d1,d2;
printf("Enter the length of rectangle : ");
scanf("%d",&d1);
printf("Enter the width of rectangle : ");
scanf("%d",&d2);
area=d1*d2;
pera=2*(d1+d2);
if(area>pera)
printf("Area is greater %d \n",area);
else
printf("Perameter is greater %d \n",pera);
}
out put:-
#include<stdio.h>
void main()
{
int area,pera,d1,d2;
printf("Enter the length of rectangle : ");
scanf("%d",&d1);
printf("Enter the width of rectangle : ");
scanf("%d",&d2);
area=d1*d2;
pera=2*(d1+d2);
if(area>pera)
printf("Area is greater %d \n",area);
else
printf("Perameter is greater %d \n",pera);
}
out put:-
No comments: