Write a program to print area of rectangle using function & return its value to main function.

Area of the Rectangle is:- Length*breath

 Code:-


#include<stdio.h>

// function for calculating the area of rectangle

int Area(int l,int b)
{
int a;
a=l*b;
return a;
}

//Driver function
int main()
{
int length,breath,A;
printf(“Enter length and breath of the Rectanglen”);
scanf(“%d%d”,&length,&breath);
A=Area(length,breath); // function calculating
printf(“Area of the Rectangle is: %d”,A);
return 0;
}

Output:-

Enter length and breath of the Rectangle
3 4
Area of the Rectangle is: 12




Leave a Reply

Your email address will not be published.