/*Jacob Dye
1/31/202CPSC 1011
Section 23
*/

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

int main (void) {

	// variables for showing precedence and integer truncation
	int x = 4, y = 3, z = -10, result = 0;

	// variables needed for volume of a sphere
	//const float PI = 3.141592;  // defines a constant: will not allow its valueu to be changed
		
	float volume = 0;    
	int radius = 0;

	// Show precedence and integer truncation
	result = y + z / x;
	printf("\nresult of y + z / x is %d, NOT %f  \n", result, -1.75);

	// Get user input 
	printf("Enter radius: ");  			
	scanf("%d", &radius);     			//changed from %d to %i
	int radius3 = pow(radius, 3);
	// volume of a sphere = 4/3 * PI * r * r * r
	volume = ((float)x / y * M_PI * radius3); //Changed pi variable into the pi variable given in the math library, Changed it to pow

	// Print sphere radius and volume
	printf("\nSphere volume = (");
	printf("%d ", x);  			 		
	printf(" / ");                          //Missing multiple "f" in printf
	printf("%d ", y);  			 		
	printf(" * ");
	printf("%f", M_PI);  			 //Changed pi variable into the one given my the math library
	printf(" * ");
	printf("%d", radius);			 	 		
	printf(" * ");
	printf("%d", radius);			 	 		
	printf(" * ");
	printf("%d:", radius);			 	 		
	printf(") = ");			 		
	printf("%.2f\n", volume);		

	return 0;
}



