Help in a problem

Revision en1, by sourabh_jangid, 2020-09-05 07:32:43

You are given three numbers as input $$$A$$$, $$$B$$$, $$$K$$$.
Perform the given below steps K times:-
if $$$A$$$ <= $$$B$$$ then
$$$B$$$ = $$$B$$$ $$$-$$$ $$$A$$$
$$$A$$$ = $$$A$$$ $$$+$$$ $$$A$$$
else
$$$A$$$ = $$$A$$$ $$$-$$$ $$$B$$$
$$$B$$$ = $$$B$$$ $$$+$$$ $$$B$$$

After K steps output the values of $$$A$$$ and $$$B$$$.
$$$0$$$ $$$\leq$$$ $$$A$$$, $$$B$$$ $$$\leq$$$ $$$10 ^ {9}$$$
$$$1$$$ $$$\leq$$$ $$$K$$$ $$$\leq$$$ $$$10 ^ {10}$$$.
If someone can give some hints it will be helpful.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English sourabh_jangid 2020-09-05 07:32:43 1549 Initial revision (published)