#include <stdio.h> #include <stdib.h> int main (int argo, char* argv[]) { printf
ID: 3628176 • Letter: #
Question
#include <stdio.h>
#include <stdib.h>
int main (int argo, char* argv[])
{
printf("hello world ! "); // this is an example
system("pause");
return 0 ;
}
It is absolutely crucial to end all of your programs with:
return 0;
as the last line before the closing '}' bracket in your main function.
Programs that do not follow this convention will not be graded correctly.
Programs that end with that line may still fail because they do not generate the right output.
Each sample run is indicated by a line of "=" symbols. These lines only indicate
the start and the end of a sample run and should not be printed by your program.
Problem 6
#########
Write a program that takes the length and width of a rectangular yard and the
length and width of a rectangular house situated in the yard. Your program
should compute the time required to cut the grass at the rate of two square feet
per second.
Remarks: Please make sure that the program interacts with the user as
shown below (the numbers may be different!).
In particular, make sure that the answer is printed with two digits of
precision (i.e., %.2f" in printf).
============= START OF SAMPLE RUN =======================
Yard length:
7.5
Yard width:
10
House length:
2
House width:
3
Seconds:
34.50
============= END OF SAMPLE RUN =======================
Explanation / Answer
please rate - thanks
with double
#include <stdio.h>
#include <stdlib.h>
int main (int argo, char* argv[])
{double lyard,wyard,lhouse,whouse,areahouse,areayard;
int sec;
printf("============= START OF SAMPLE RUN ======================= ");
printf("Yard length: ");
scanf("%lf",&lyard);
printf("Yard width: ");
scanf("%lf",&wyard);
printf("House length: ");
scanf("%lf",&lhouse);
printf("House width: ");
scanf("%lf",&whouse);
areahouse=lhouse*whouse;
areayard=lyard*wyard;
areayard-=areahouse;
areayard/=2;
printf("Seconds: %.2f ",areayard);
printf("============= END OF SAMPLE RUN ======================= ");
system("pause");
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.