利用goto,算出最小公倍數


            int number1=255, number2=800,number3=0,product=0;
            int temporarily = Math.Max(number1, number2);
            number2  = Math.Min(number1, number2);
            number1 = temporarily;
            product = number1 * number2;
            while1:
            number1 = number1 > number2 ? number1 : number2;
            number3 = number1 % number2;
            number1 = number2;
            number2 = number3;
            if (number2 != 0)
                goto while1;
            Console.Write(product/number1);

沒有留言:

張貼留言