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 >>

Well, my first suggestion would be to read things about posting... before posting... Please us BB code tags.

Secondly, I'm not seeing the ending bracket to your main() function..

Now... other than that, what problems are you having? Any errors?

Apologies, but I'm not even sure what the code tags are or how to use them, and yes I read the post. Like I said, I'm new at this. Point taken on the ending brackets, I will try that. No error messages, warnings though. The program will run in spite of the warnings, just not with any usable info.


Thanks

code tags with spaces added to make them visible - [ code ] to begin the segment, [ /code ] to end it.

well, I'm at home now and have my compiler to run this through...
Error on the second printf() statement... you forgot a semicolon
since you listed main to return int, you really should return an integer...
add return 0 to the end..

Now onto the other problems...
I'm not seeing these variables initialized to anything, you should set them before you try to assign anything to them. Also, are you trying to use %= or some other modifier in your statements using Vs, As, Vc, Ac?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.