PGCD2SyntaxePGCD2(n1, n2) Calcule le PGCD de 2 nombres n1 et n2. Les paramètres et le résultat sont au format nombre. Par mickay.jill@9online.fr ExemplePGCD2(35, 15) ---> 5 Scripton PGCD2(n1, n2) repeat if n1 > n2 then set a to n1 - n2 set n2 to n1 set n1 to a else if n1 < n2 then set a to n1 set n1 to n2 - n1 set n2 to a end if if n1 = n2 then exit repeat end repeat return n1 end PGCD2
RemarqueMéthode par soustractions successives.
|