Good morning, could you help me to perform the following problem using  scilab? Using basic commands like while. Thank you very much in advance. Write a program that can compute the greatest common divisor of a pair of positive integers a and b. As a reminder, the greatest common divisor is the largest integer that divides each of the numbers with no remainder. For example: The greatest common divisor of 2 and 12 is 2. The greatest common divisor of 17 and 12 is 1 The greatest common divisor of 9 and 12 is 3. A tip is to start testing with a number equal to the smaller of the two numbers entered by the user and iteratively reduce this test value by 1 until you reach the case where this value can divide both a and b without leaving a remainder or simply finish if this test value reaches 1.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 21PE
icon
Related questions
icon
Concept explainers
Question
100%

Good morning, could you help me to perform the following problem using  scilab? Using basic commands like while.
Thank you very much in advance.
Write a program that can compute the greatest common divisor of a pair of positive integers a and b. As a reminder, the greatest common divisor is the largest integer that divides each of the numbers with no remainder. For example:
The greatest common divisor of 2 and 12 is 2.
The greatest common divisor of 17 and 12 is 1
The greatest common divisor of 9 and 12 is 3.
A tip is to start testing with a number equal to the smaller of the two numbers entered by the user and iteratively reduce this test value by 1 until you reach the case where this value can divide both a and b without leaving a remainder or simply finish if this test value reaches 1.

 

 

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Operators
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT