C Program To Find GCD using Pointers and Functions, using Euclid's Algorithm

preview_player
Показать описание

Write a function to compute the greatest common divisor given by Euclid's algorithm, exemplified for J = 1980, K = 1617 as follows:

1980 / 1617 = 1 1980 - 1 * 1617 = 363
1617 / 363 = 4 1617 - 4 * 363 = 165
363 / 165 = 2 363 - 2 * 165 = 33
5 / 33 = 5 165 - 5 * 33 = 0

Thus, the greatest common divisor is 33.

Analyze Above Problem Statement
1. We need to find Greatest Common Divisor(GCD) of 2 numbers entered by the user, using Euclid’s Algorithm.

2. If J = 1980 and K = 1617, GCD should be 33.

3. Make sure to use the calculation part as shown in problem statement.

4. We observe the calculation part in problem statement and formulate some formulas to figure out the result i.e., GCD of 2 numbers input by the user.

C Programming Interview / Viva Q&A List

C Programming: Beginner To Advance To Expert
Рекомендации по теме
Комментарии
Автор

that was so clear and perfect thank you..<3.

gamma-is
Автор

Thank u so much bhai....was waiting for this video only

rishabhjhafreestyler
Автор

One correction.
You wrote 5/33=5, but it is 165/33=5

バテンカイトスライ
Автор

Thank u so much, but why my result come 363? i could not solve it

QuickPixls
Автор

Can we solve this problem with the help of recursion

ty_b__ramkrushna_karnika
welcome to shbcf.ru