Created
October 4, 2015 19:49
-
-
Save sams96/cf07915224f0a3a0fc29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
double calcE(double m, double c) { | |
double e; | |
double c2; | |
c2 = pow(c, 2); | |
e = (m * c)/10; | |
return e; | |
} | |
void printE(double m, double c) { | |
double e = calcE(m, c); | |
printf("The energy available from an object of mass %d is %d.2 PJ\n", | |
m, e); | |
return ; | |
} | |
int main() { | |
double c = 2.99792458; | |
printE(1, c); | |
printE(3.142, c); | |
printE(10, c); | |
printE(42, c); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment