C program to find area and perimeter using function
#include<stdio.h>
int area(int l,int w)
{
int ar;
ar=l*w;
return ar;
}
int perimeter(int l,int w)
{
int p;
p=2*(l+w);
return p;
}
int main()
{
int a,b,d,e;
printf("Enter Length of Rectangle : ");
scanf("%d",&a);
printf("\nEnter breadth of Rectangle : ");
scanf("%d",&b);
d=area(a,b); // calling function rect_area
e=perimeter(a,b); // calling function perimeter
printf("\nArea of Rectangle = %d",d);
printf("\n\nPerimeter of Rectangle = %d",e);
return 0;
}
No comments:
Post a Comment