Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Square pyramid
//gcc 5.4.0 #include <stdio.h> double square(double side){ //The square function is calculating the square of the input// return(side*side); } double Volume(double side, double h){ //The volume 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// } int main(void) { double x=10; //The main function initializes the two variables we are going to use// double y=3; //(side of a base, and height) even if they aren't called that// printf("Volume is %f\n", Volume(x,y)); //This prints the value returned from the volume function// return 0; //NOTE: the x and y are evaluated in the Volume function that they are called to as "side" and "h"// }
run
|
edit
|
history
|
help
2
Please
log in
to post a comment.
18BCE2182 ASSESS_1 Q1-5
#Define / Case/ If practice
Fgets and String Stuff
C assignment due sunday
polymorphism simulation in plain C with a simple structures
Tree
exercises
Assignment 2
TeleBook2
tst2.c
Please log in to post a comment.