输入两个数字 任何一个数字都不能大于10!
using System;
using System.Collections.Generic;
using System.Text;namespace ConsoleApplication12
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b;
            start:Console.WriteLine("请输入第一个数字");
            a = Convert.ToInt32(Console.ReadLine());
            if (a > 10)
            {
                Console.WriteLine("你输入的数字为{0}大于10,请重新输入", a);
                goto start;
            }
            else if (a<10)
            {
            er:Console.WriteLine("请输入第二个数字");
                b=Convert .ToInt32 (Console.ReadLine());
                if (b > 10)
                {
                    Console.WriteLine("刚才输入的数字{0}大于10,请重新输入第二个数字", b);
                    goto er;
                }
                else
                {
                    Console.WriteLine("你输入的数字为{0}和{1}", a, b);
                }
            
            }
        }
    }
}

解决方案 »

  1.   

            static void Main(string[] args)
            {
                int a, b;
                a = GetA();
                b = GetB();
                Console.WriteLine("您输入的两个数字是{0},{1}", a, b);
            }
            private static int GetB()
            {
                int b;
                Console.WriteLine("请输入第二个数字");
                b = Convert.ToInt32(Console.ReadLine());
                if (b > 10)
                {
                    b = GetB();
                }
                return b;
            }        private static int GetA()
            {
                int a;
                Console.WriteLine("请输入第一个数字");
                a = Convert.ToInt32(Console.ReadLine());
                if (a > 10)
                {
                    a = GetA();
                }
                return a;
            }
      

  2.   

    楼主,你这不是c#,你只是把一段vb代码,照着c#样子画出来而已。