Saturday, 14 December 2019

Write a java program to swap a two integer using third variable Temporary.

Program :

class Swap
{
    public static void main(String[] args) {
       
        int x = 5 ;
        int y = 7 ;
        int temp ;
        temp = x ;
        x = y ;
        y = temp ;

        System.out.println("After Swapping " +x);
        System.out.println("Before Swapping " +y);

    }
}

Output :


No comments:

Post a Comment

Write a java program to input marks of 5 student if 5 subject out of 100 marks each , output sum and percentage of marks and appropriate division i.e distigusion first class upto fail

Programe : import java.util.*; class Student { public static void main(String args[])     {     Scanner s = ...