Hi all,
I am new in programming with C. Will you please help me to solve the following problem:
I want a program whose function is to enter the volume of a sphere 'x' and the program has to find out the unknown radius of the sphere and when the program finds radius, the program has to tell you if the sphere can go through the pipe or not.
Code:
#include <stdio.h>
void main ()
{
float a,b;
printf("If you have a sphere with a volume of 'x', will it fit in a pipe with a radius of 5cm ??\n\n");
printf("Enter volume 'x': ");
scanf("%f",&a);
printf("The radius of the shpere is: %f\n\n",((a*3)/(4*3.142))^0.333);
b= ((a*3)/(4*3.142))^0.333;
if (b>5)
{printf("The sphere will not fit in the pipe.\n\n\n\n");}
else if (b<5)
{printf("The sphere will fit in the pipe.\n\n\n\n");}
else
printf("The sphere will fit in the pipe tightly.\n\n\n\n");}
}