Code:/*Name:Brian Date:9/3/17 First Project */ #include <stdio.h> int main(void) { double mass=0.00, acceleeration=0.00 , force=0.00,radius=0.0, height=0.0, volume=0.0, pi=3.14 ; //1. Promot the user for the mass and acceleration printf("Please enter the mass and accleeration <both floating-points values> for use in Newton's Second Law "); //2. Get the mass and accleration from the user scanf("%lf %lf", &mass, &acceleeration); //printf("%d %d\n", mass, acceleeration); //3. Mutliply the mass with accelleration force = mass * acceleeration; //4. Put it together printf("Newton's Second Law: force = mass*acceleeration= %lf\n",force); //2.1 Promot the user for the radius and height printf("Please enter the radius and the height <both floating-point values> for use in a volume of a cylinder equation "); //2.2 Get the radius and height from the user scanf("%lf %lf", &radius, &height); //2.3 Get the value of the volume volume = (1 / 3)*radius*pi*height*radius; //2.4 Put it together printf("Volume of a cylinder: volume_cylinder = PI* radius^2*height= %lf\n", volume); }
Whenever i run the volume part of my code, i get 0.000 as my answer. I'm not sure what i did wrong. Any help is welcome, thanks.