Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

gcd

public int HCFOfTwoNumbers(int a, int b)
{
  while (a != 0 && b != 0)
  {
    if (a > b) a %= b;
    else b %= a;
  }
  return a==0?b:a;
}
 
PREVIOUS NEXT
Tagged: #gcd
ADD COMMENT
Topic
Name
6+7 =