/*Cary Dill
 * 1/31/23
 * Lab Section 001
 * Lab number 2
 * Program takes in input and uses it to calculate the radius of a given sphere
 * */

		
#include <stdio.h>
#include <math.h>
int main (void) {

        // variables for showing precedence and integer truncation
        int x = 4, y = 3, z = -10;//CHANGED TO FLOAT
        float a = (float) x;
	float b = (float) y;
//	float c = (float) z;

	int result = z / x +y;
	result = round(result); //CAST A ROUNDED INT
	

        // 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 truncation
        printf("\nresult of y + z / x is %d, NOT %.2f  \n", result, -1.75);

        // Get user input
        printf("Enter radius: ");
        scanf("%d", &radius);
	int r = radius; // CAST TO INT

        // volume of a sphere = 4/3 * PI * r * r * r
        volume = a / b * M_PI * pow(r,3); //POWER AND PI MATH

        // Print sphere radius and volume
        printf("\nSphere volume = (");
        printf("%d ", x); //ERROR
        printf(" / ");
        printf("%d ", y); //ERROR
        printf(" * ");
        printf("%f", M_PI); //ERROR
        printf(" * ");
        printf("%d ",radius);
        printf(" * ");
        printf("%d ",radius);//ERROR
        printf(" * ");
        printf("%d ",radius); //ERROR
        printf(") = ");
        printf("%.2f\n", volume);

        return 0;
}



