Search This Blog

This website completely moved to new domain. For latest content, visit www.programmingposts.com

C# PROGRAM TO ADD TWO INTEGERS WITHOUT USING THIRD VARIABLE



C# Program To Add Two Numbers/Integers without using Third Variable :

using System;
 
namespace CsharpPrograms
{
    class Program
    {
        static void Main(string[] args)
        {
 
            int x,y;
            Console.WriteLine(">>> PROGRAM TO ADD TWO NUMBERS WITHOUT USING THIRD VARIABLE <<< ");
            Console.Write("\n Enter the first number to be added: ");
            x=Convert.ToInt32(Console.ReadLine());         // taking x value from keyboard
            Console.Write("\n Enter the second number to be added: ");
            y = Convert.ToInt32(Console.ReadLine());         // taking y value from keyboard
            x = x + y;     /*assining the value of sum of x and y to x*/
 
          Console.WriteLine("\n The sum of two numbers is: "+x);    /*printing the sum.*/
          Console.ReadLine();
        }
    }
}

Output:



..For C Program : c program to add two numbers without using third variable

9 comments:

  1. A awesome information thanks for sharing.
    C# Training
    c sharp training in chennai

    ReplyDelete
  2. The post is written in very a good manner and it entails many useful information for me. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept.
    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune
    Selenium Online training

    ReplyDelete
  3. I have been meaning to write something like this on my website and you have given me an idea. Cheers.
    python Course in Pune
    python Course institute in Chennai
    python Training institute in Bangalore

    ReplyDelete

  4. This post is so interactive and informative.keep update more information…
    IELTS Coaching in anna nagar
    IELTS Coaching in Chennai

    ReplyDelete
  5. This post is so useful and informative. Keep updating with more information.....
    Reasons To Learn English
    Best English Course

    ReplyDelete