2015.3.3(上)

练习题:

(一)   1—100之间,输入两个数,算两个数之间的和?

//Console.WriteLine("请输入一个整数");             //int a = Convert.ToInt32(Console.ReadLine());             //Console.WriteLine("请在输入一个整数");             //int b = Convert.ToInt32(Console.ReadLine());             //int x = 0;             //for (int i = a; i <=b; i++)             //{             //    x = x +i;             //}             //Console.WriteLine(x);             //Console.ReadLine();

(二)  1—100之间,输入两个数,再输入一个符号,求(+,-,*,/)?

 //           Console.WriteLine("请输入一个数");  //           double c = Convert.ToDouble(Console.ReadLine());  //           Console.WriteLine("请在输入一个数");  //           double d = Convert.ToDouble(Console.ReadLine());  //           Console.WriteLine("请在输入一个运算符号(+,-,*,/)");  //           string y=Convert.ToString(Console.ReadLine());  //           double x = 0;              //               switch (y)  //    {               case "+":  //                       x=c+d;  //        break;  //                   case "-":  //                       x=c-d;  //                       break;  //                   case "*":  //                       x=c*d;  //                       break;  //                   case "/":  //                       x=c/d;  //                       break;  //       default:  //                       Console.WriteLine("你输入的有错误");  //break;  //    } Console.WriteLine(x);  //               Console.ReadLine();

原文地址:https://www.cnblogs.com/m123/p/4310683.html