Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Friday, September 30, 2022

C program to find area and perimeter using function

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;

}


Output:



You may also Read:


No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages