This preview shows pages 1–2. Sign up to view the full content.
Sheet1
Page 1
/*
MAE 9: Homework #2, Fall 2008
Due on Monday, October 13, Turnin from 9:00am  9:00pm
Compute the area (A) and the volume (V) of a sphere with
radius R=0.1, R=0.2, R=0.3, .
.. , R=1.5 . Compute also the
total area (TA) and the total volume (TV) of all these spheres
together. Finally, compute the average radius, average area, and
average volume of considered spheres (R_av, A_av, V_av).
Define PI by using #define and use a forloop to repeat
calculations for different values of R. (Use PI=3.141593 and recall
the elementary formulas A=4*PI*R*R and V=4*PI*R*R*R/3 or V=A*R/3).
For each sphere, print in one line
Sphere (k)
Radius = "number"
Area = "number"
Volume = "number"
At the end, in a separate line, print
Total Area = "number"
Total Volume = "number"
In a separate line print also:
Average Radius = "number"
Average Area = "number"
Average Volume = "number"
Use the output specifier 2d for k (k is a sequential number of the sphere),
4.1f for R, and 7.3f for A, V, TA, TV, R_av, A_av, V_av.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 01/10/2009 for the course MAE MAE 9 taught by Professor Lubarda during the Fall '08 term at UCSD.
 Fall '08
 Lubarda

Click to edit the document details