Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
shapes and such
//gcc 5.4.0 #include <stdio.h> #define pi 3.14 double square(double side); //These are called the function signitures// double Volume(double side, double h); //They just initialize the function themselves along with the variables they use// double VolumeP(double side, double h); double CylindricTank(double radius, double h); int main(void) { double side=4; double h=10; double radius=2; printf("Volume of rectangular prism is %f\n", Volume(side,h)); printf("Volume of Square Pyramid is %f\n", VolumeP(side,h)); printf("Volume of Cylindrical Tank is %f\n", CylindricTank(radius, h)); printf("Volume of Cone is %f\n", (CylindricTank(radius,h)/3)); //becuase a cone is 1/3 the value of a cylindrical tank, we just take 1/3 of the previous statement// return 0; } double square(double side){ //The square function is calculating the square of the input// return(side*side); } double Volume(double side, double h){ return(square(side)*(h)); } double VolumeP(double side, double h){ //The VolumeP functions calculates the volume using the square from the square funcion and height, which is inputed// return(square(side)*(h/3.0)); //The actual math is (a^2)*(1/3h) which is calculating the area of a square pyramid// } double CylindricTank(double radius, double h){ //CylindricTank function finds the volume of a cylindrical tank using radius, a defined pi value, and height// return(square(radius)*(pi)*(h)); //The actual math is pi(r^2)h// }
run
|
edit
|
history
|
help
0
StructSurvey
Area & Perimeter of Circle
printint a struct
lambda
Welcome1
FILE_Access
20171117_PITAGORAS
array and its sum
fork() System call
2-dimension array got area by malloc()