Thursday, September 4, 2014

calculate the area of a rectangle using a function


Problem

Write a function that calculates the area of a rectangle. The prototype of the function is
int aor(int len, int bre);

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int aor(int len, int bre);
main()
{
 int len,bre,c;
 printf("Enter length and bredth of the rectangle : ");
 scanf("%d%d",&len,&bre);
 c = aor(len,bre);

 printf("Area of the rectangle : %d",c);
 system("pause");
}
int aor(int len, int bre)
{
 int c;
 c = (len * bre) ;
 return c;
}

Sample Output


No comments :

Post a Comment

Note: Only a member of this blog may post a comment.

Copyright 2017. All Rights Reserved. Privacy Policy / Terms And Conditions / Sitemap / Contact