Homework2-1

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

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

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
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