Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>//library for printf and return 0
- double pow(double X, double Y);// This will tell the computer to square X (base) by however many times Y (the exponent). Although I don't really need it, because of the math.h library.
- int main(void){
- double X;//assign the variables as doubles
- double Y=2; // because the lab asks for the number to be squared I set the exponent to 2.
- double sum;
- printf("Please Enter Variables: ");
- scanf("%lg",&X);
- sum= pow(X,Y);// because of the math.h library, the computer will take the number that the user inputs and plug them into the equation.
- printf("This is the answer: %g",sum);//don't need to scanf sum because the sum is already defined to the equation pow(X,Y).
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment