1. Write a Java program to convert an int to double and display the result.
2. Perform explicit type casting from double to int and show what happens to the decimal
part.
3. Take a char input and print its corresponding ASCII value using type casting.
4. Widening conversion: Convert a byte value into long and print all intermediate
conversions (byte → short → int → long).
5. Write a program to swap two numbers using arithmetic operators (without a third
variable).
6. Demonstrate the difference between post-increment (i++) and pre-increment (++i)
using a small program.
7. Write a program to calculate the result of ((a+b) * (a-b)) / 2 using operators.
8. Use logical operators to check if a number is divisible by both 2 and 3.
9. Accept a student’s mark and print the grade using an else-if ladder.
10. Write a program to check if a given character is a vowel or consonant using switch.
11. Create a program to find the largest of three numbers using nested if.
12. Write a java program to check Whether the given year is a leap year or Not.
13. Write a program to print the first 10 natural numbers using a for loop.
14. Write a program to calculate the factorial of a number using a while loop.
15. Write a program to print the multiplication table of a given number using a do-while
loop.
16. Write a program to find the sum of digits of a number using a loop.
17. Write a program to find the largest element in an integer array.
18. Write a program to find the sum and average of elements in an array.
19. Write a program to search for a given element in an array (linear search).
Real Time Task: ATM
===== ATM Menu =====
1 → Account Registration
2 → Profile View
3 → Check Balance
4 → Deposit Money
5 → Withdraw Money
6 → Change PIN
8 → Exit
Enter your choice: 1
Enter your Name: Vikram
Set your PIN: 1234
Enter Initial Deposit (Min ₹500): ₹1000
Account Created Successfully!
===== ATM Menu =====
1 → Account Registration
2 → Profile View
3 → Check Balance
4 → Deposit Money
5 → Withdraw Money
6 → Change PIN
8 → Exit
Enter your choice: 2
===== Profile =====
Name: Vikram
Balance: ₹1000.0
===== ATM Menu =====
1 → Account Registration
2 → Profile View
3 → Check Balance
4 → Deposit Money
5 → Withdraw Money
6 → Change PIN
8 → Exit
Enter your choice: 4
Enter deposit amount: ₹500
Deposited Successfully! New Balance: ₹1500.0
===== ATM Menu =====
1 → Account Registration
2 → Profile View
3 → Check Balance
4 → Deposit Money
5 → Withdraw Money
6 → Change PIN
8 → Exit
Enter your choice: 5
Enter withdrawal amount: ₹200
Withdrawn Successfully! New Balance: ₹1300.0
===== ATM Menu =====
1 → Account Registration
2 → Profile View
3 → Check Balance
4 → Deposit Money
5 → Withdraw Money
6 → Change PIN
8 → Exit
Enter your choice: 6
Enter current PIN: 1234
Enter new PIN: 5678
PIN Changed Successfully!
===== ATM Menu =====
1 → Account Registration
2 → Profile View
3 → Check Balance
4 → Deposit Money
5 → Withdraw Money
6 → Change PIN
8 → Exit
Enter your choice: 8
Thank you! Goodbye!