i have made a program to find the area of a rectangle but it always gives area 0.Dont get why.
#include<stdio.h>
#include<conio.h>
struct rectangle
{
float width;
float length;
}rect;
void rectangleget(void);
void rectangleset(void);
void area( void);
void perimeter(void);
void main(void)
{
clrscr();
rectangleset();
rectangleget();
area();
perimeter();
getch();
}
void rectangleset(void)
{
for(;;)
{
printf("enter length:");
scanf("%f",&rect.length);
if(!(rect.length>0 &&rect.length<=20.00))
{
printf("invalid entry");
}
else
{
break;
}
}
}
void rectangleget(void)
{
char ch;
for(;;)
{
printf("enter width:");
scanf("%f",&rect.length);
if(!(rect.length>0 &&rect.length<=20.00))
{
printf("invalid entry Try again\n");
}
else
{
break;
}
}
}
void area(void)
{
float areaa=1;
areaa=rect.length*rect.width;
printf("area is %f",areaa);
}
void perimeter(void)
{
float peri=0;
peri=2*(rect.length+rect.width);
printf("perimeter is %f",peri);
}