115k views
4 votes
write a program that reads in the length and the width of a rectangular yard . your program should compute the time required ( in minutes ) to cut the grass at the rate of 2.3 square meters a second

User Chris Pan
by
8.9k points

1 Answer

4 votes
Here's on C:
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
long YardArea=0,HouseArea=0;
int YardLength=0,YardWidth=0,HouseLength=0,HouseWidth=0;
long GroundArea=0;
int TimeReqierd=0;
int GrassCutRate=2;
void main()
{
char inp[256];
clrscr();
printf("your text text\\"); // put your greetings
printf("Input the leght of the yard\\");
gets(inp);
YardLength= atoi(inp);
printf("input the width of the yard\\");
gets(inp);
YardWidth=atoi(inp);
printf("input the length of the house\\");
gets(inp);
HouseLength=atoi(inp);
printf("input the width of the house\\");
gets(inp);
HouseWidth=atoi(inp);
HouseArea=HouseWidth *HouseLength ;
YardArea=YardWidth* YardLength;
GroundArea=YardArea-HouseArea;
TimeReqierd=GroundArea/GrassCutRate;
printf("%s%d","Grass Area is ",GroundArea);
printf("%s%d seconds"," \\ time required to cut it out " ,TimeReqierd);
getchar();
}
User Steve Eynon
by
7.3k points

No related questions found