Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a,b,c,d,e,f;
- int LICZBY_PITAGOREJSKIE(int a, int b, int c){
- d=c*c;
- e=b*b;
- f=a*a;
- if(d==a*a+b*b){
- return 1;
- }
- else if(f==b*b+c*c){
- return 2;
- }
- else if(e==a*a+c*c){
- return 3;
- }
- else{
- return false;
- }
- }
- int main()
- {
- cout << "Podaj 3 liczby: " << endl;
- cin >> a;
- cin >> b;
- cin >> c;
- cout << LICZBY_PITAGOREJSKIE(a,b,c) << endl;
- if(LICZBY_PITAGOREJSKIE(a,b,c)==1){
- cout << "S¹ to liczby pitagorejskie" << endl;
- }
- else if(LICZBY_PITAGOREJSKIE(a,b,c)==0){
- cout << "Nie s¹ to liczby pitagorejskie" << endl;
- }
- else{
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment