Better way of finding GCD

can’'t we just do (suppose a and b are 2 numbers and min is minimum of the 2)
for(i=min/2;i<=1;i=i/2)
{ if(i%a==0 && i%b==0)
{ cout<<i;
break;}
}

I think it will be faster than recursive one because in it

  1. program goes till 0;
  2. if b>a then 1 iteration is wasted.

correction in the above question in loop
for(i=min/2;i>=1;i=i/2)

i here will always be less than a and b, and thus i%a or i%b will never be 0…the code will never enter the if condition in this case

Hey Naman,
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.