Sample Questions
1. Write a java program to check if the given number is Krishnamurthy
number or not. A Krishnamurthy number is a number whose sum of
the factorial of digits is equal to the number itself. 145 is
Krishnamurthy's number because 1! + 4! + 5! = 145.
2. Draw the flowchart of the above problem.
3. Write a java program to print the given series:
1, 4, 7, 10, 13 … n terms.
4. Print the patterns using loop
A
BAB
CBABC
DCBABCD
EDCBABCDE
5. Print the patterns using loop
********
** **
* * * *
* * * *
* * *
* * * *
* * * *
** * *
********
6. Write a java program to convert a decimal number to binary number. Draw the
flow-diagram of the given problem. [Ex: Decimal: 15 then Binary: 1111]
7. Write a program to read three numbers from the keyboard and print the number
which is neither larger nor smaller (do not use if-else statement). Write the
execution patterns of the given problem. [Ex: n1=10, n2=30, n3 = 20, then
output: 20]
8. Write a java program using a loop to print the given pattern.
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
9. Write a program to enter 10 numbers from the user and display the
largest and smallest numbers using any loop.
10. Write a program to print Fibonacci series of n terms where n is input
by user :
0 1 1 2 3 5 8 13 24 …. n terms
11. Write a program to calculate the sum of the following series where n
is input by user.
1 + 1/2 + 1/3 + 1/4 + 1/5 +…………1/n
12. Print the patterns using loop
1
222
33333
4444444
555555555