Interchange


Program to interchange values stored in 'a' and 'b'







SOURCE CODE


import java.io.*;
import java.util.*;
public class Interchange
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        System.out.print("Enter first number  :");
        int a=sc.nextInt();
        System.out.print("Enter second number :");
        int b=sc.nextInt();
        System.out.println("The values before interchange are "+a+" \t "+b);
        int c;
        c=a;
        a=b;
        b=c;
        System.out.println("The values after interchange are "+a+" \t "+b);
    }
}


Click here to Download



OUTPUT

                                                   


If you have any question then leave a comment below I will do my best to answer that question.

Comments

Popular posts from this blog

[Question 3] ISC 2017 Computer Practical Paper Solved – Caesar Cipher.

Pattern of your own name.

Designing Patterns - Print 'Z'.