Hey, I'm new here and I have a question that's baffling me.
I'm making an equation generator for the volume of a cone, but it won't stop equaling 0, and I have other equations that work, and I made them in the same fashion.
Code:
#include <stdio.h>
#define PI 3.141592
int main (void)
{
/* Volume of a cone: 1/3 * PI * radius^2 * height */
double v = 0, r = 0, h = 0;
printf("Enter 2 floating-point values (radius and height) for use in volume of a cone equation: ");
scanf("%lf%lf", &r, &h);
(double) v = (double) (1/3) * PI * (double) (r * r) * (double) h;
printf ("Volume of a cone: volume_cone = 1/3 * PI * radius^2 * height = 1/3 * %lf * (%lf^2) * %lf = %lf\n", PI, r, h, v);
return (0);
}
Thanks for any help that might come, and with any luck you guys will be seeing a lot of me as I pursue a career in computer science