reset and begin
7/09/2010

tìm ước chung lớn nhất

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;
else
b=b-a;
}
return a;
}



[caption id="" align="alignnone" width="241" caption="ucnn"]ucnn[/caption]

Bloger Comments
G+ Comments
Comments FaceBook

No comments:

List

Profiles Information


About me : Nothing is 1 vài thứ - 1985

Places I've Lived : I Hà Nội

Home Page : http://www.shimivn.blogspot.com/

Think : 1:1000000000

Languages spoken : Vietnamese,English.

Mobile : sony C2305

dell : i3-Ram 3GB- HDD 250GB .