编程论坛's Archiver

haibo5210 发表于 2008-5-10 11:36

求助 简单程序 无法看清

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            int m=245;
            int n=60;
            int s;
            while (n!=0)
            {
            s=m%n;
            m=n;   
            n=s;
            }
            Console .WriteLine ('最大公约数:{}",m)
        }
}
我想要代码停留在最后的结果上面  希望各位网友帮帮忙  说下该怎么实现

bleach46 发表于 2008-5-10 16:26

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            int m=245;
            int n=60;
            int s;
            while (n!=0)
            {
            s=m%n;
            m=n;   
            n=s;
            }
            Console .WriteLine ("最大公约数:{0}",m);
            Console .Read();
        }
   }
}

[[it] 本帖最后由 bleach46 于 2008-5-10 16:34 编辑 [/it]]

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.