JAVA PROGRAMMING LAB 1
Experiment 1: Addition of Two Numbers
Problem Definition: Write a program to read two integer numbers and find
their sum.
Sample Input:
10
20
Sample Output:
Sum = 30
Experiment 2: Area of a Circle
Problem Definition: Write a program to read the radius of a circle and
calculate its area.
Sample Input:
5
Sample Output:
Area = 78.50
Experiment 3: Odd or Even Number
Problem Definition: Write a program to read an integer and determine
whether it is odd or even.
Sample Input:
25
Sample Output:
Odd Number
Experiment 4: Largest of Two Numbers
Problem Definition: Write a program to read two numbers and find the larger
number.
Sample Input:
15
28
Sample Output:
Largest Number = 28
Experiment 5: Swap Two Numbers
Problem Definition: Write a program to interchange the values of two
numbers.
Sample Input:
10
20
Sample Output:
After Swapping: First Number = 20, Second Number = 10
Experiment 6: Simple Interest
Problem Definition: Write a program to calculate Simple Interest.
Sample Input:
10000
5
2
Sample Output:
Simple Interest = 1000.00
Experiment 7: Perimeter of a Rectangle
Problem Definition: Write a program to find the perimeter of a rectangle.
Sample Input:
10
5
Sample Output:
Perimeter = 30
Experiment 8: Positive, Negative or Zero
Problem Definition: Write a program to determine whether a number is
positive, negative, or zero.
Sample Input:
-15
Sample Output:
Negative Number
Experiment 9: Celsius to Fahrenheit Conversion
Problem Definition: Write a program to convert temperature from Celsius to
Fahrenheit.
Sample Input:
25
Sample Output:
Fahrenheit = 77.00
Experiment 10: Multiplication Table
Problem Definition: Write a program to display the multiplication table of a
given number up to 10.
Sample Input:
5
Sample Output:
5 x 1 = 5 ... 5 x 10 = 50
Experiment 11: Sum of First N Natural Numbers
Problem Definition: Write a program to find the sum of the first N natural
numbers.
Sample Input:
10
Sample Output:
Sum = 55
Experiment 12: Check Leap Year
Problem Definition: Write a program to determine whether a given year is a
leap year.
Sample Input:
2024
Sample Output:
Leap Year