Saturday, October 30, 2021

Addition and Difference of Two Numbers in C#

 A simple program that will ask the user to give two numbers and then the program will compute the sum and difference of two numbers using C# programming language.

  I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a=0,b=0;
            Console.WriteLine();
            Console.WriteLine("\tAddition and Difference of Two Numbers in C#");
            Console.WriteLine();
            Console.Write("\tEnter First Value  : ");
            a = Convert.ToInt32(Console.ReadLine());
            Console.Write("\tEnter Second Value : ");
            b = Convert.ToInt32(Console.ReadLine());
            int Addition=0, Difference=0;

            Addition = (a+b);
            Difference = (a-b);

            Console.WriteLine();
            Console.WriteLine("\tThe sum of " + a.ToString() + " and "
                + b.ToString() + " is " + Addition.ToString() + ".");
            Console.WriteLine();
            Console.WriteLine("\tThe difference  " + a.ToString() + " and "
                       + b.ToString() + " is " + Difference.ToString() + ".");
            Console.WriteLine("\n");
            Console.WriteLine("\tEnd of Program");
            Console.ReadLine();  
        }
    }
}


No comments:

Post a Comment