summaryrefslogtreecommitdiff
path: root/sphererevol.c
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-02-06 11:26:44 -0500
committerAlexander Pickering <alexandermpickering@gmail.com>2017-02-06 11:26:44 -0500
commit97a693d996c79fb2a008b19750d8bb45512e01a2 (patch)
tree6df17bfe7de7c59f7b1083828d71a91e61fae9fa /sphererevol.c
downloadengr0016-master.tar.gz
engr0016-master.tar.bz2
engr0016-master.zip
Inital commitHEADmaster
Diffstat (limited to 'sphererevol.c')
-rw-r--r--sphererevol.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sphererevol.c b/sphererevol.c
new file mode 100644
index 0000000..ff1bbf8
--- /dev/null
+++ b/sphererevol.c
@@ -0,0 +1,14 @@
+/*Calculates the volume of a sphere*/
+#include <math.h>
+#include <stdio.h>
+
+int main()
+{
+ double radius = 5;
+ float pi = M_PI;
+ double radiusCubed = pow(radius,3);
+ float answer = (4*pi*radiusCubed/3);
+
+ printf("The volume of a sphere with radius %f is %f\n",radius,answer);
+ return 0;
+ }