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

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("Enter the radius of the sphere "); scanf("%lf", &rad); /*calculate volume from given radius*/ v = 4 / (3 * II * (rad*rad*rad)); /*display calculated volume*/ printf("The volume is %lf .\n", v); return (0); }...
View Full Document

This note was uploaded on 08/06/2008 for the course EGR 261 taught by Professor Parikh during the Spring '08 term at Grand Valley State.

Ask a homework question - tutors are online