Homework2-1 - double v; //calculated volume double temp;...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework #2 /* * Program by Justin Waters * Inputs: radius of a spere * Outputs: volume of a sphere * Description: User inputs the radius of a sphere and the program will calculate the volume of that sphere and print the results * */ #include <stdio.h> //standard header file #include <math.h> //math operations #define II 3.14159 int main (void) { double rad; //radius entered by user
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: double v; //calculated volume double temp; //radius cubed for calculations /*Get the radius of sphere */ printf(&quot;Enter the radius of the sphere &quot;); scanf(&quot;%lf&quot;, &amp;rad); /*calculate volume from given radius*/ v = 4 / (3 * II * (rad*rad*rad)); /*display calculated volume*/ printf(&quot;The volume is %lf .\n&quot;, v); return (0); }...
View Full Document

Ask a homework question - tutors are online