c語言實驗6 Problem B 尋求勾股數

2021-07-24 18:45:57 字數 600 閱讀 7176

滿足x2+y2=z2的正整數x,y和z稱為一組勾股數(pythagorean triple),又稱為畢達哥拉斯三元陣列。現在要求你程式設計求指定範圍內的勾股數。

輸入若干對數a和b,每對數佔一行。0

輸出為多行,與上述輸入一一對應。

每行輸出首先輸出用例編號「case i",其中i為行號,從1開始計數。

如果指定範圍內有勾股數,則按照x從小到大的順序輸出每組勾股數,每組勾股數要求x如果指定範圍內沒有勾股數,則輸出」no pythagorean triple「。

1 10

6 9

case 1:3,4,5;6,8,10

case 2:no pythagorean triple

&&

#include #include #include #include int main()}}

if(gs == 0)

printf("no pythagorean triple");

printf("\n");

tp++;

}return 0;

}

C語言 實驗6

一 用乙個函式來實現將一行字串中最長的單詞輸出。此行字串從主函式傳遞給該函式。include include intmain intjudge char c intlongest char string else len else if len length return place 二 從鍵盤讀入...

C語言實驗 排列

c語言實驗 排列 time limit 1000ms memory limit 65536kb problem description 有4個互不相同的數字,請按序輸出由其中三個不重複數字組成的排列。input 4個整數。output 所有排列,輸出順序見樣例。example input 1 2 3...

C語言 實驗整理

實驗二 陣列操作 實驗三 呼叫函式 實驗四 指標,處理字串 課程設計 銷售業績管理系統 感想 題目求1 1 2 1 3 1 4 1 99 1 100之值。求出200到300之間的數,且滿足條件 它們三個數字之積為42 三個數字之和為12。一 include intmain printf f sum ...