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
1
Pointer Example
Finite State Machine Program Example (ECE 2534)
Is const really const? Yes
Spring 2017 Project 2 v1.6
18BCE2182 ASSESS_2 Q1
formatting_input_and_output
WrongWay reversible iterator Copyright(C) 2016 Henry Kroll III www.thenerdshow.com
Project 3 part 2 Book v1.1
10
2