Tuesday, April 6, 2021

18.6. Write a function that gets length and width of a rectangle and returns area.

#include<stdio.h>
#include<conio.h>
long RectArea(int l, int w)
{
return (long)l*w;
}
void main()
{
int length, width;
clrscr ();
printf ("Enter first number: ");
scanf("%d",&
length):
printf ("Enter second number: ");
scanf ("&d", &
width):
printf ("Area= %ld", 
RectArea(lengthwidth)); 
getch ();
}

No comments:

Post a Comment