Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Modify program so that user can input two sides, the function pyth is called then the length of the third side is displayed.
- # include <stdio.h>
- # include <math.h>
- int square(int y);
- float square(float y);
- float pyth(float sideA, float sideB);
- int main(void){
- float inputNum = 0;
- printf("What number do you want to square? ");
- scanf("%f", &inputNum);
- printf("Square using pow(inputNum,2) is %f ", pow(inputNum,2));
- printf("Square using square(inputNum) is %f \n", square(inputNum));
- }
- int square(int y){
- return y * y;
- }
- float square(float y){
- return y * y;
- }
- float pyth(float sideA, float sideB){
- float sideC = 0;
- float sideCSquare = sideA * sideA + sideB * sideB;
- sideC = sqrt(sideCSquare);
- return sideC;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement