Write a function GCD( int A, int B ), when called from main function, returns the GCD (Greatest Common Divisor) of two numbers. Also get two numbers, X and Y from user and call this function to...

My registration number is 689Write a function GCD( int A, int B ), when called from main function, returns the<br>GCD (Greatest Common Divisor) of two numbers. Also get two numbers, X and Y from<br>user and call this function to calculate GCD and show the result on Monitor. X and Y<br>must be your reg# and 786, respectively.<br>Note: GCD, Greatest Common Divisor: GCD of two numbers is the greatest number<br>which can divide both the numbers. If the smaller of the two numbers can divide the<br>larger number then the GCD is the smaller number. Else starting from 1 to (smaller / 2),<br>check whether the current element divides both the numbers . If yes, then<br>the highest of these devisors is the required GCD.<br>

Extracted text: Write a function GCD( int A, int B ), when called from main function, returns the GCD (Greatest Common Divisor) of two numbers. Also get two numbers, X and Y from user and call this function to calculate GCD and show the result on Monitor. X and Y must be your reg# and 786, respectively. Note: GCD, Greatest Common Divisor: GCD of two numbers is the greatest number which can divide both the numbers. If the smaller of the two numbers can divide the larger number then the GCD is the smaller number. Else starting from 1 to (smaller / 2), check whether the current element divides both the numbers . If yes, then the highest of these devisors is the required GCD.

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here