Advertisement
wiktormadera

zad15

Apr 2nd, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int LICZBYPITAGOREJSKIE(int a, int b, int c)
  6. {
  7.     if(a*a+b*b==c*c)
  8.     {
  9.         return 1;
  10.     }
  11.     else
  12.     {
  13.         return 0;
  14.     }
  15. }
  16.  
  17. int main()
  18. {
  19.     int a,b,c,d
  20.     cout << "Liczby pitagorejskie. Podaj a: " << endl;
  21.     cin >> a;
  22.     cout << "Podaj b: " << endl;
  23.     cin >> b;
  24.     cout << "Podaj c: " << endl;
  25.     cin >> c;
  26.     d = LICZBY_PITAGOREJSKIE(a,b,c);
  27.     {
  28.         cout << "Podane liczby sa liczbami pitagorejskimi.";
  29.     }
  30.     else if(d==0)
  31.     {
  32.         cout << "Podane liczby nie sa liczbami pitagorejskimi.";
  33.     }
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement