---
# System prepended metadata

title: 21-7 三角形斜邊長
tags: [DICE C]

---

---
tags: DICE C
---

21-7 三角形斜邊長
===

> [name=CHAWTeam]

目錄：[DICE C語言程式破解](/@CHAWTeam/DiceC)

題目
---

```!
輸入第一個整數，代表測試資料筆數，

接下來每行輸入兩個數字代表x、y，請使用數學函式hypot，求出x^2+y^2的平方根。

輸入範例:
6
10 10
20 20
30 30
40 40
50 50
60 60

輸出範例:
14.142136
28.284271
42.426407
56.568542
70.710678
84.852814
```

程式碼
---

```c=
#include <stdio.h>
#include <math.h>

int main()
{
    float n, x, y;
    scanf("%f", &n);
    
    for (int i = 0; i < n; i++)
    {
        scanf("%f %f", &x, &y);
        printf("%f\n", hypot(x, y));
        
    }
    return 0;
}
```

執行
---

### 輸入

```!
6
10 10
20 20
30 30
40 40
50 50
60 60
```

### 輸出

```!
14.142136
28.284271
42.426407
56.568542
70.710678
84.852814
```

---

[查看我們在HackMD上的所有筆記](/@CHAWTeam)
目錄：[DICE C語言程式破解](/@CHAWTeam/DiceC)

---

{%hackmd Iiu5mOixR7yWkPHKCkabBg %}
<iframe class="LikeCoin" height="235" src="https://button.like.co/in/embed/chawteam/button?referrer=https://hackmd.io/@CHAWTeam/DiceC-21-7" width="100%"></iframe>

---

{%hackmd i1nMRrZcTFmTvoF897K9zg %}