123456789101112131415161718
#include <stdio.h> #define PIE 3.14 float cone (float height,float radius); int main () { float height,radius; printf("Enter your cone height:"); scanf("%f",&height); printf("Enter your cone radius:"); scanf("%f",&radius); printf("The volume of your cone is %f",(cone(height,radius))); } float cone (float height,float radius) { float volume; volume=(1/3)*PIE *radius*radius*height; return volume; }
1.0/3.0
12345678910111213141516171819
#include <stdio.h> #define PIE 3.14 float cone (float height,float radius); int main () { float height,radius; printf("Enter your cone height:"); scanf("%f",&height); printf("Enter your cone radius:"); scanf("%f",&radius); printf("The volume of your cone is %f",(cone(height,radius))); } float cone (float height,float radius) { float volume; volume=PIE*radius*radius*height/3; return volume; }
#define PIE 3.14
double
float