0 like 0 dislike
1k views
勾股定理(英語:Pythagorean theorem)又稱商高定理、畢達哥拉斯定理、畢氏定理、百牛定理,是平面幾何中一個基本而重要的定理。 勾股定理說明,平面上的直角三角形的兩條直角邊的長度(古稱勾長、股長)的平方和等於斜邊長(古稱弦長)的平方。請設計一個程式,找出週常在N已內所有符合勾股定理的整數三角形三邊長。請注意不要重複喔。

sample input:

100

sample output:

3 4 5
5 12 13
6 8 10
7 24 25
8 15 17
9 12 15
9 40 41
10 24 26
12 16 20
12 35 37
15 20 25
15 36 39
16 30 34
18 24 30
20 21 29
21 28 35
24 32 40
[Exercise] Coding (C) - asked in 2016-1 程式設計(一)AD by (18k points)
ID: 15448 - Available when: 2016-10-27 18:30:00 - Due to: 2016-10-27 21:00:00

reshown by | 1k views

5 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

int main()

{

    int a,b,c,d;
* * **** * * ** * *** *** * **

    for(c=1;c<=d/100*41;c++)

    {
* ** **** ** * *** ** *** ** **** * ** ** ** * **
** ** * ** * ******* * * * ** * ** **** *
* **** * **** *** * * *** * ** *** * ******** ** *** ** ****** **
*** * ** * ** ** * * **** * *** * * *** * * * ** ********** * ** *
**** * **** ***** *** * * ** ** ** * * * * * ** **** * * * * * *** * *** * * * * * * **
******* * * * * * * *** *** *** * * ** * * * * * * * *** * ** *** * ** * * ** * * * *** ** **
** * ** ** ** * * * *** * **** * ** * * ****** * **** * ******* * * * * ** * ** *** **** * *** ** ** *** * ** %d %d\n",a,b,c);
* ** * * * * ** *** ** *** ******** ** ** * **** * *** *** * * ** ** ** **** ** * ****
* * **** * * ** * ** * * ***** * * ** *** * * * * * *** **
* * * *** ** ** ***** ****** * * ** * * ***

    }
*** * ****** * ** ** * * * ** * ** **** *

    return 0;

}
answered by (-90 points)
0 like 0 dislike
Hidden content!
#include <stdlib.h>

#include <stdio.h>



int main(int argc, char *argv[])

{

 int i,n,a,b,c;

 scanf("%d",&n);

 

 for(a = 1; a < n; a++){

       for(b = a;b <= n-a ; b++){
* *** ** *** * *** *** ****** * * * * **** * * *** * * ** * ** = 5; c <=(n-a-b);c++){
*** * * * * **** * * ** * * *** * **** **** ******* * *** * ** *** * **** ** ** * **** ** * * * *** * * **** * * * == a*a + b*b)
** *** *** * * *** * ** ** ** * ** * * * ** ** ** * ** ** ** *** * **** ** * **** * ** ** *** * * ** ** * ** *** *** *** ** * ** %d %d\n",a,b,c);

             }

       }

 } * * ** * * ** ** *** ** *** * * * * ******* *** ** * ***** * * * * **** ** ** * * * *** ** * * * * *** ** *** ***** ** *** ** **** * * * ***** ** ** * * * * **** ******* * * *** * * * * *** * * **** ** ** * * * ** * **** * *** * * * * ** * *** * * *** *** *** * * **** ** * * * **** * ***** ** *** * ** * ** ** *** *** * *** ** *** * * *** ** *** ** ** * * * *** * *** *** * * * ** * * * ** * * * * * * * *** * * ** ** * *** *** ** * *** * * ** *** ** * * * * * * * ** * ** ** **** ** ** *** *** * * * *** * ** *** * * ** * **** **** **** * * * * *** * * * **** * * ** * **** ** *** ** *** * * * * *** * * * * ** ** * * * ** * * * ****** ** * ** ** *** * * * * ****** * *** * * * * ** *** * ** * * * * ** * * * * ** * * * ** *** ** * ** * * * ** ** ** ** * * ** ** ** ** * ** * **** ** **** * * * ** * *** **** ** ** * ** * * ******** * * ** * ** * * * * * * ** ****** *** ** ** * ****** ** * * * **** *** *** * * * * ** * * * *** * * ** **** * *** *** ** * * * ** ** * * * ** * * ** * ***** ***** ** ** * * * * * ****** * * ** *** * * * * ***** *********** * ** *** * * *** *** * * * ** ** ** * ** * ** **** ** * *** ** * *

 return 0;

}
answered by (-216 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

int main()

{

    int a,b,c,d;
* ** * * ***** ** * * * ** * *** ** *

    for(c=1;c<=d/5*2;c++)

    {
** * * ** ***** ** * * ** ** **** * * * * * *** ** * * *
**** * * * *** ******* ** * * ***** *
**** * **** * *** ** * * ** ** * * * *** * * * ***** * *** *
* ** ****** * * *** *** **** * * **** ** * * *** * * **
* *** *** ******** ** ** *** **** * * ** ** * * * ***** **** * * * ** **** * ** ** * **
* ** ** ** ** * ** ** * * ****** ***** * *** * ** * * * * * *** ** * *** * ** *** **
* **** * ** * * * * * ** * ** **** ** * * ** * * *** **** *** *** * * ** * *** **** * *** ** * * * * * ** * * %d %d\n",a,b,c);
* ** * * * ** **** * ***** **** * * ** * * * ** ** *** ***** * * * * *** * * ** *
* *** * * * * ****** ** ** *** ** * * ***** *** * ** ***** ** * * * *
* * ** * * ** * * * * * **** * ** *** ** ******

    }
** * * *** ** * ** * * *** *** *** * * ** *

    return 0;

}
answered by (-90 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()

{
*** ** ** ***** * ** * i;
* ** * * * * * * **** *** *** &i);
** * ** * ***** * ** *** ** ***** * ***** * ** * * * ** * ** ** * * * * ** * *** * **** ******* * **

}
answered by (-94 points)
0 like 0 dislike
Hidden content!
***** **** * * ****
*** * *

* * * **** ****** i;
* *** * **** * * * ***** * ** *********
* ** * **** **** **** *** 4 12 ** 8 *** 24 ** * 15 *** 12 * 40 ** 24 *** * 16 **** 35 ** 20 ** * 36 * * * ** 24 *** 21 * 28 **** ** **

}
answered by (-94 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.17.58
©2016-2025

Related questions

0 like 0 dislike
33 answers
[Exercise] Coding (C) - asked Oct 27, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 15445 - Available when: 2016-10-27 18:30:00 - Due to: 2016-10-27 21:00:00
| 3.8k views
0 like 0 dislike
11 answers
[Exercise] Coding (C) - asked Oct 27, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 15441 - Available when: 2016-10-27 18:30:00 - Due to: 2016-10-27 21:00:00
| 1.9k views
0 like 0 dislike
73 answers
[Exercise] Coding (C) - asked Oct 27, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 15439 - Available when: 2016-10-27 18:30:00 - Due to: 2016-10-27 21:00:00
| 6.7k views
0 like 0 dislike
41 answers
[Exercise] Coding (C) - asked Oct 27, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 15427 - Available when: 2016-10-27 18:30:00 - Due to: 2016-10-27 21:00:00
| 4.6k views
0 like 0 dislike
28 answers
[Exercise] Coding (C) - asked Oct 27, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 15421 - Available when: 2016-10-27 18:30:00 - Due to: 2016-10-27 21:00:00
| 3.5k views
12,783 questions
183,442 answers
172,219 comments
4,824 users