/*
   Isiah Pham
   1/31/2023
   Section 004
   Lab2
  
   Lab 2 - Program description:
   The program prints a statement about 4 + 3 / -10 and then it takes a radius input and outputs the volume of a sphere with that radius

*/

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

int main (void) {

	// variables for showing precedence and integer truncation
	// *added a commma after x = 4
	int x = 4,  y = 3, z = -10, result;

	// variables needed for volume of a sphere
	//const float PI = 3.141592;
	// *changed colon to semicolon
	float volume = 0;    			
	int radius = 0;


	// Show precedence and integer truncation
	// *added int to result
	result = y + z / x;
	// *added parantheses at the end of the printf statement and moved quotations before 		result and -1.75
	printf("\nresult of y + z / x is %d, NOT %.2f \n", result, -1.75);

	// Get user input
	// *Added a parantheses and a semicolon to the printf function
	printf("Enter radius: ");
	//  *Moved the right quotation mark before after the comma	
	scanf("%d", &radius);     			

	// volume of a sphere = 4/3 * PI * r * r * r
	// *changed r to radius in the equation
	volume = x / (float)y * M_PI * pow(radius, 3);

	// Print sphere radius and volume
	printf("\nSphere volume = (");
	// *Added comma before x
	printf("%d ", x); 			 		
	printf(" / ");
	// *Added comma before y
	printf("%d ", y);  			 		
	printf(" * ");
	// *Added comma before m_PI
	printf("%f", M_PI);  			 		
	printf(" * ");
	// *Added %d to the radius printf statements
	printf("%d", radius);			 	 		
	printf(" * ");
	printf("%d", radius);			 	 		
	printf(" * ");
	printf("%d ", radius);			 	 		
	printf(") = ");				 		
	printf("%.2f\n", volume);		

	return 0;
}



