#includeusingnamespacestd;intmain(){unsignedint a, b;cin>> a >> b;while( a != b )if( a < b ) b -= a;else a -= b;cout<< a <<endl;return0;}
Oblicz NWD
Podaj a
Podaj b
...
Kod Javascript
<script>function NWD(){var a = document.getElementById("a").value;var b = document.getElementById("b").value;var w ="";while(a<b) b -= a else a -= b;
t = a;
document.getElementById("wynik").innerHTML = w;}</script>
Kod Python
def NWD(a, b):while a != b:if a > b:
a = a - b
else:
b = b - a
return a
a=int(input())
b=int(input())print(NWD(a,b))