Exercises:
(a) between 1-100, enter two numbers, calculate the and between two numbers?
//console.writeline ("Please enter an integer"); //int a = Convert.ToInt32 (Console.ReadLine ()); //console.writeline ("Please enter an integer"); //int B = Convert.ToInt32 (Console.ReadLine ()); //int x = 0; //for (int i = A; I <=b; i++) & nbsp; //{ // x = x +i; //} //console.writeline (x); //console.readline ();
(b) 1-100, enter two numbers, and then enter a symbol (+,-,*,/)?
// Console.WriteLine ("Please enter a number"); // double c = convert.todouble (Console.ReadLine ( )); // Console.WriteLine ("Please enter a number"); // Double D = convert.todouble (Console.ReadLine ( )); // Console.WriteLine ("Please enter an operation symbol (+,-,*,/)"); // 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 ("You have entered an error "); //break; // } Console.WriteLine (x); // Console.ReadLine () ;
2015.3.3 (ON)