/* 	Mara Kinsey
	CPSC 1011 
	Section 002
	Lab #2
	2/2/2023
	The first part of this program demonstrates operator precence and 
	integer truncation. The second part asks the user to enter one number 
	which will be used as the radius to calculate the volume of a 
	sphere.
 */


#include <stdio.h>
#include <math.h>

int main (void) {

	// variables for showing precence and integer trucation
	// missing comma after x = 4 and initial value for results
	int x = 4, z = -10, result = 0;
	//y or x need to be float to make volume calculate correctly
	float y = 3;
	// variables needed for volume of a sphere
	//const float PI = 3.141592;  //defines a constant: will not allow 
	// its value to be changed
	float volume = 0;
	int radius = 0;

	//Show precedence and integer trucation
	// missing semicolon after function
	result = y + z / x ;
	// missing parantheses after printf function and ' used instead of " 
	//after \n
	printf("\nresult of y + z / x is %d, NOT %0.2f  \n",result, -1.75);

	// Get user input
	// missing parentheses before printf function and ; after
	printf("Enter radius: ");   
	// missing " after %d 
	scanf("%d", &radius);

	// volume of a sphere = 4/3 * PI * r * r * r
	// missing declaration for varaible r
	int r = radius ;
	// use M_PI and pow for equation 
	volume =(x/y) * M_PI * pow(r,3) ;

	// Print sphere radius and volume
	//Combine printf statements into one statement
	printf("\nSphere volume = (%d / %.0f * %f * %d * %d * %d ) = %.2f \n", x, y ,M_PI, r , r , r 
, volume);

        return 0;

}

	
