Greatest common divisor: Difference between revisions

Content added Content deleted
No edit summary
m (→‎version 2: typos)
Line 2,689: Line 2,689:
gcde=arg(n) /* Expected result */
gcde=arg(n) /* Expected result */
gcdx=gcd(arg(1),arg(2)) /* gcd of the first 2 numbers */
gcdx=gcd(arg(1),arg(2)) /* gcd of the first 2 numbers */
Do i=2 To n-2 /* proceed with all te others */
Do i=2 To n-2 /* proceed with all the others */
If arg(i+1)<>0 Then
If arg(i+1)<>0 Then
gcdx=gcd(gcdx,arg(i+1))
gcdx=gcd(gcdx,arg(i+1))
Line 2,697: Line 2,697:
Else /* result is not correct */
Else /* result is not correct */
Tag='*** wrong. expected:' gcde
Tag='*** wrong. expected:' gcde
numbers=arg(1) /* build sting to show the input */
numbers=arg(1) /* build string to show the input*/
Do i=2 To n-1
Do i=2 To n-1
numbers=numbers 'and' arg(i)
numbers=numbers 'and' arg(i)