ASP.NET MVC, MVC, C#, PYTHON, JQUERY

Sunday, May 31, 2020

Program for swap two integer values

Source Code:

using System;

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

namespace ConsoleProgramming
{
    class Program
    {
        static void Main(string[] args)
        {
            SwapNumbers();
        }
       
        //Swap two numbers
        public static void SwapNumbers()
        {
            int a = 10, b = 5;
            Console.WriteLine("Before swapping numbers are a={0},b={1}", a, b);
            a = a - b;
            b = a + b;
            Console.WriteLine("After swapping numbers are a={0}, b={1}", a, b);
            Console.ReadLine();
        }
     }
}

Output:

Share:

0 comments:

Post a Comment

SOCIAL PROFILES

Search This Blog

Powered by Blogger.

Fixed Menu (yes/no)

yes

Contact Form

Name

Email *

Message *

Tags

Ads Section

Tags

ASP.NET MVC (7) C# (11) jQuery (1)