• API
• FAQ
• Tools
• Trends
• Archive
daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Jun 19th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. //Modify program so that user can input two sides, the function pyth is called then the length of the third side is displayed.
2.
3. # include <stdio.h>
4. # include <math.h>
5.
6. int square(int y);
7. float square(float y);
8. float pyth(float sideA, float sideB);
9.
10. int main(void){
11.     float inputNum = 0;
12.     printf("What number do you want to square? ");
13.     scanf("%f", &inputNum);
14.     printf("Square using pow(inputNum,2) is %f ", pow(inputNum,2));
15.     printf("Square using square(inputNum) is %f \n", square(inputNum));
16. }
17.
18.
19. int square(int y){
20.
21.     return y * y;
22.
23. }
24.
25. float square(float y){
26.
27.     return y * y;
28.
29. }
30.
31. float pyth(float sideA, float sideB){
32.     float sideC = 0;
33.     float sideCSquare = sideA * sideA + sideB * sideB;
34.     sideC = sqrt(sideCSquare);
35.     return sideC;
36. }
RAW Paste Data
Top