i can calculate gcd between 2 and 3 number but how can i calculate gcd multiple nuber i,e 10 number 20 number .
i need logic and idea. possibly help me for coding.
here is my effort. i want to modify it for calculate multiple number.
Code:#include<stdio.h> int main() { int j,k,a,b,c,l; scanf("%d%d%d",&a,&b,&c); l=a; while(k!=0) { k=a%b; a=b; b=k; } while(j!=0) { j=l%c; l=c; c=j; } if(l==a) printf("\n gcd is %d",a); else printf("\n gcd is 1"); return 0; }