I've already turned this in for (I hope) partial credit, so I'm not asking for help in getting a grade. However, future assignments build off of this type of program, so I do need to understand how to make this work. I believe it is painfully obvious that I am very new at this, so any/all help and suggestions will be greatly appreciated.
Place a sphere inside a cube such that the sphere just touches the sixsides of the cube. If the spere has diameter d, then the cube will have a side equal to d.
d = 3.5 units
PI = 3.14159
Volume of a sphere:
Vs = PI*d cubed/6
Area of sphere:
As = PI*d squared
Volume of a cube:
Vc = d cubed
Area of cube:
Ac = 6*d squared
Calculate all values and print them on screen with some text describing the calculations.
Well, that's it. Any and all sugestions, help, input is appreciated.
Thanks
#include<stdio.h>
#include<math.h>
#define PI 3.14159
#define D 3.5
int main(void) {
float diameter=3.5;
float cube=3.5;
float Vs,As,Vc,Ac;
/*Vs=PID3/6
1) PI
2) pow(D.3)
3) divide by 6*/
/*As=PID2 */
/*Vc=D3 */
/*Ac=6D2 */
printf("\nMy name is Gordy Noon");
printf("\n\n\nThe diameter of the sphere is %f\n",diameter)
printf("Vs=%0.3f\n");
printf("As=%0.3f");
printf("\n\n\nThe length of the side of the cube is %f\n",cube);
printf("Vc=%0.3f/n");
printf("Ac=%0.3f");
<< moderator edit: added [code][/code] tags >>