static void Main(string[] args) { while (true) { jiecheng n = new jiecheng(); int result = n.Jc(Convert.ToInt16(Console.ReadLine())); Console.WriteLine("result is {0}", result); //Console.ReadKey(); } }
static void Main(string[] args) { jiecheng n = new jiecheng(); int result = n.Jc(Convert.ToInt16(Console.ReadLine())); //控制台输入一个值,通过Convert.ToInt16()转成int类型 //int16:-32768 到 32767 //int32:-2,147,483,648 到 2,147,483,647 Console.Write("result is {0}", result); Console.ReadKey(); }