View Code of Problem 90

#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
    int a,b,t;
    scanf("%d,%d",&a,&b))
        if(a>b){
            t=a;
            a=b;
            b=t;
        }
        for(int i=a;i<b;i++){
            for(int j=i;j<b;j++){
                for(int k=j;k<=b;k++){
                    if(pow(i,2)+pow(j,2)==pow(k,2)){
                        cout<<i<<"^2+"<<j<<"^2="<<k<<"^2"<<endl;
                    }
                }
            }
        }
    return 0;
}

/*
Main.cc: In function 'int main()':
Main.cc:7:25: error: expected ';' before ')' token
     scanf("%d,%d",&a,&b))
                         ^
Main.cc:6:13: warning: unused variable 't' [-Wunused-variable]
     int a,b,t;
             ^
*/

Double click to view unformatted code.


Back to problem 90