summaryrefslogtreecommitdiff
path: root/sphererevol.c
diff options
context:
space:
mode:
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;
+ }