c^2=a^2+b^2修正版

#include<iostream>
#include<fstream>
using namespace std;
int main(){
    ofstream outfile("f1.txt",ios::out);
    for(int a=1;a<500;a++)
        for(int b=a+1;b<500;b++)
            for(int c=a+1;c<=500;c++){
                if(a*a+b*b==c*c){
                    outfile<<"a="<<a<<"  "<<"b="<<b<<"  "<<"c="<<c<<endl;
                }
            }
            outfile.close();
}

猜你喜欢

转载自blog.csdn.net/wanwu_fusu/article/details/82856225