Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

It is absolutely crucial to end all of your programs with: return 0; as the last

ID: 3628353 • Letter: I

Question

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.

Use 64-bit floating point numbers (i.e., double) for all floating
point calculations. Do not use float as your results may differ from the test cases
due to small precision errors.


Problem 4
#########

Given parameters b and h which stand for the base and the height
of an isosceles triangle (i.e., a triangle that has two equal sides),
write a C program that calculates:

 the area of the triangle
 the perimeter of the triangle

the volume of the cone formed by spinning the triangle around the line h

The program must prompt the user to enter b and h.


Math refresher: Isosceles triangle




          area = (b*h)/2
          perimeter = b + 2*a
          volume = (1/3)*(area of cone's base)*(height)





Remarks: Please replicate the exact text of the prompts and the
output. Make sure that the answers are printed with three digit precision
(i.e., "%.3f" in printf). Even though the text must be the same, the
numbers may be different depending on the user input.


============= START OF SAMPLE RUN =======================
Enter the base of the isosceles triangle:
17.0
Enter the height of the isosceles triangle:
20.0
The area of the triangle is 170.000
The perimeter of the triangle is 60.463
The volume of the cone formed by spinning the triangle is 1513.200
============= END OF SAMPLE RUN =======================

Explanation / Answer

# include # include int main() { double b,h, area, perimeter,volume; printf("Enter the base of the isosceles triangle: "); scanf("%lf", &b); printf("Enter the height of the isosceles triangle: "); scanf("%lf", &h); //area of triangle area=(b*h)/2; //perimeter of triangle perimeter=b+(sqrt(b*b + 4*h*h)); printf("The area of the triangle is %.3lf ",area); printf("The perimeter of the triangle is %.3lf ",perimeter); //area of cone base area=(3.141*b*b)/4; printf("The area %.3lf ",area); volume=(1.0/3.0)*area*h; printf("The volume of the cone formed by spinning the triangle is %.3lf ", volume); return 0; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote