Experiment 1: Aim - : Introduction of Java. Theory - : What Is Java?
Experiment 1: Aim - : Introduction of Java. Theory - : What Is Java?
Program
Output
Program
import java.util.Scanner;
res = a + b;
System.out.println("Addition = " +res);
}
}
Output
Enter Two Numbers: 5
6
Addition = 11
Experiment 4
Program
import java.util.Scanner;
res = a - b;
System.out.println("Subtraction = " +res);
}
}
Output
Enter Two Numbers: 6
5
Subtraction = 1
Experiment 5
Program
import java.util.Scanner;
res = a / b;
System.out.println("Division = " +res);
}
}
Output
Enter Two Numbers: 10
2
Division = 5
Experiment 6
Program
import java.util.Scanner;
res = a * b;
System.out.println("Multiplication = " +res);
}
}
Output
Enter Two Numbers: 10
2
Multiplication = 20
Experiment 7
Program
import java.util.Scanner;
if(a>b)
{
big = a;
}
else
{
big = b;
}
Output
Program
import java.util.Scanner;
if(a<b)
{
big = a;
}
else
{
big = b;
}
Output
Program
import java.util.Scanner;
Program
import java.util.Scanner;
swap = num1;
num1 = num2;
num2 = swap;
System.out.print("The Value of the First and Second Number after Swapping is \n");
Output
Program
Output
*
**
***
Experiment 12
Program
import java.util.Scanner;
area = len*bre;
peri = (2*len) + (2*bre);
OUTPUT
Program
OUTPUT
Program
if(num%2 == 0)
{
System.out.print("This is an Even Number");
}
else
{
System.out.print("This is an Odd Number");
}
}
}
OUTPUT
Enter a Number: 9
This is an Odd Number