Wednesday, March 20, 2013

C#: Enter two variables a, b (integer). Calculate the total and the results on the screen.


//Example: Write a program with type Console Application, enter two integers a, b. Please calculate the total and the results on the screen.
using System;
namespace Total{
    class Program{
        static void Main (){
            int a, b;
            Console.Write ("Enter first integer:");
            a = int.Parse (Console.ReadLine ());
            Console.Write ("Enter second integer:");
            b = int.Parse (Console.ReadLine ());
            Console.WriteLine (a + b);
            Console.ReadLine ();
        }
    }
}

No comments:

Post a Comment