function ucln($a,$b){ $a=abs($a);$b=abs($b);if ($a==0 ||$b==0)return $a+$b;while ($a !=$b){if($a>$b)$a=$a-$b;else$b=$b-$a;}return $a;}echo ucln(42,56);trong C#static int USCLN(int a, int b) { a=Math.Abs(a); b=Math.Abs(b); if (a==0 ||b==0) return a+b; while (a !=b) { if(a>b) a=a-b;
No comments:
Post a Comment