zoukankan      html  css  js  c++  java
  • 直角三角形个数

    #include <iostream>
    using namespace std;
    int main( )
    {    int a,b,c;
       for (a=1; a<20; a++)
          for (b=1; b<20; b++)
             for (c=1; c<=20; c++)
              if (a*a+b*b==c*c)    
                            printf("a=%d,b=%d,c=%d
    ",a,b,c);
          system("pause");    return 1;
    }     
    View Code
    #include <iostream>
    using namespace std;
    int main( )
    {    int a,b,c;
       for (a=1; a<20; a++)
          for (b=1; b<20; b++)
             for (c=1; c<=20; c++)
              if (a*a+b*b==c*c)    
                            printf("a=%d,b=%d,c=%d
    ",a,b,c);
          system("pause");    return 1;
    }     

     #include <iostream>
    using namespace std;
    int main( )

      int a,b,c;
        for (a=1; a<20; a++)
        for (b=a; b<20; b++)
          for (c=b; c<=20; c++)


       if (a*a+b*b==c*c) 
                                cout<<"a="<<a<<"  b="<<b<<"  c="<<c<<endl;
       system("pause"); return 1;

    ********************************************************************************

    #include <iostream>

    #include<math.h>

    using namespace std; int main( )

    {   int a,b,c;     

       for (a=1; a<20; a++)    

    for (b=a+1; b<20; b++)   

       {          c=sqrt(a*a+b*b);

     if (a*a+b*b==c*c)

    cout<<"a="<<a<<" b="<<b<<" c="<<c<<endl;

    }

      return 1;

    }


  • 相关阅读:
    阿里云与物理服务器
    ## 100个网路基础知识##
    Linux 中vim编辑器
    Linux 目录结构及增删改查
    Linux 命令行常用快捷键
    XSS劫持cookie登录
    Tomcat
    centos 6.5 搭建DHCP实验
    centos 6.5 系统故障分析实验
    LVM的创建及管理
  • 原文地址:https://www.cnblogs.com/wc1903036673/p/3870545.html
Copyright © 2011-2022 走看看