C++ Question

Правка en1, от Vahagn_Grigoryan, 2021-04-18 10:38:52

Hi, Codeforces Community!

I recently looked to a programm written by a participant in the contest, and I noticed this function, which is finding the greatest common devisor of two numbers.

long long int gcd(lli a, lli b) { return (b == 0LL ? a : gcd(b, a % b)); }

But I don't understand how this part (b == 0LL ? a : gcd(b, a % b)) of the function is working. Can anyone explain please?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Vahagn_Grigoryan 2021-04-18 10:39:55 20 Tiny change: ' int gcd(lli a, lli b) { retu' -> ' int gcd(long long int a, long long int b) { retu'
en1 Английский Vahagn_Grigoryan 2021-04-18 10:38:52 409 Initial revision (published)