Assignment 1
Assignment-1 (2 Days)
Objective:
The objective of this assignment is to learn how to write some Simple JAVA Programs.
1. Write a program to print your name.
2. Write a program to read the price of an item in the decimal form (like 75.95) and print the
output in paise (like 7595 paise).
3. Write a program to convert the given temperature in Fahrenheit to Celsius using the
following conversion formula:
C = (F-32)/1.8
4. Write a program to determine sum of the following series for given value of n:
1 - 1/22 + 1/32 - ..... + 1/n2
5. Write a program to find the sum of digits of a given integer number (1st day using static i/p
and 2nd day using command-line argument).
6. Write a Java Program to take two inputs (name and college name) through command line
argument and print as follows:
<name> is a [Link] student of <college name> college.
E.g.:
Input:
Ram AOT
Output:
Ram is a [Link] student of AOT college
7. Write a program to find the reverse of a given integer number (1st day using static i/p and 2nd
day using command-line argument).
8. Write a program to check whether a given integer number is palindrome or not (1st day
using static i/p and 2nd day using command-line argument).
9. Write a Java Program to demonstrate arithmetic operations between two numbers using
command line arguments.
10. Write a Java Program to check if a number is Even or Odd.
11. Write a Java Program to swap two numbers using the bitwise operator.
12. Write a Java Program to check Leap Year.
13. Write a Java Program to multiply a number by 2 and divide the same number by 4 using
shift operator.
14. Write a program to find the factorial of a given integer number using recursion.
15. Write a program to find the factorial of a given integer number using dynamic
programming.
16. Write a Program of Sum of Series (1+x+x2+x3+x4+………… up to n-th terms).
17. Write a program to calculate the Simple Interest (si) while your inputs are principle (p), time
in years (n) and rate of interest (r).
18. Write a program to find the roots of the quadratic equation ax2 + bx + c = 0 where a, b and c
are constants.
19. Write a program to show Fibonacci series up to n-th terms using recursion.
20. Write a program to show Fibonacci series up to n using recursion.
21. WAP to check whether a number is prime or not using recursion.
22. WAP to print all prime number within a given range.
23. WAP to calculate GCD/HCF and LCM of two numbers.
24. WAP to print all Armstrong numbers within a given range.
25. WAP to calculate GCD/HCF and LCM of n numbers.
26. WAP to print all perfect numbers within a given range.
27. Write a Java Program to convert a binary number to decimal number and vice versa.
28. Write a Java Program to display the sequence ABA, BCB, CDC, DED,…
29. Write a Java Program to display the sequence AMM, COO, EQQ ,..........
30. Write a Java Program to display the sequence A1, B2, C3, ....Y25, Z26, A1, B2,........