Please write a program to find the greatest common divisor of  three number.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 22PE
icon
Related questions
Question

Write in C language

Description

 

請寫一個程式找到三個數的最大公因數。

Please write a program to find the greatest common divisor of  three number.

 

Input

 

輸入會包含多筆測試資料,每筆測試資料一行,每行中有三個正整數,整數間會用一個空白隔開。

Input consist several test case, each test case a line. For every test case there are three integer in it and separate by a space.

 

Output

 

對每一筆測試資料輸出一行結果。

For each test case output the result in one line.

 

Sample Input 1 

3 6 9
10 15 20

Sample Output 1

3
5
Description
請寫一個程式找到三個數的最大公因數。
Please write a program to find the greatestcommon divisor of three number.
Input
輸入會包含多筆測試資料,每筆測試資料一行,每行中有三個正整數,整數間會用一個空白隔開。
Input consist several test case, each test case a line. For every test case there are three integer in it and separate by a space.
Output
對每一筆測試資料輸出一行結果。
For each test case output the result in one line.
Sample Input 1 É
Sample Output 1
36 9
3
10 15 20
5
Transcribed Image Text:Description 請寫一個程式找到三個數的最大公因數。 Please write a program to find the greatestcommon divisor of three number. Input 輸入會包含多筆測試資料,每筆測試資料一行,每行中有三個正整數,整數間會用一個空白隔開。 Input consist several test case, each test case a line. For every test case there are three integer in it and separate by a space. Output 對每一筆測試資料輸出一行結果。 For each test case output the result in one line. Sample Input 1 É Sample Output 1 36 9 3 10 15 20 5
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr