RafalSobala

zad 15

Mar 31st, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int a,b,c,d,e,f;
  6.  
  7. int LICZBY_PITAGOREJSKIE(int a, int b, int c){
  8.  
  9.     d=c*c;
  10.     e=b*b;
  11.     f=a*a;
  12.  
  13.     if(d==a*a+b*b){
  14.         return 1;
  15.     }
  16.     else if(f==b*b+c*c){
  17.         return 2;
  18.     }
  19.     else if(e==a*a+c*c){
  20.         return 3;
  21.     }
  22.     else{
  23.         return false;
  24.     }
  25. }
  26.  
  27. int main()
  28. {
  29.     cout << "Podaj 3 liczby: " << endl;
  30.     cin >> a;
  31.     cin >> b;
  32.     cin >> c;
  33. cout << LICZBY_PITAGOREJSKIE(a,b,c) << endl;
  34.     if(LICZBY_PITAGOREJSKIE(a,b,c)==1){
  35.         cout << "S¹ to liczby pitagorejskie" << endl;
  36.     }
  37.     else if(LICZBY_PITAGOREJSKIE(a,b,c)==0){
  38.         cout << "Nie s¹ to liczby pitagorejskie" << endl;
  39.     }
  40.     else{
  41.  
  42.     }
  43.     return 0;
  44. }
Add Comment
Please, Sign In to add comment