Computer_Lab_Assignment_StdIX_Set1 (2)
Computer_Lab_Assignment_StdIX_Set1 (2)
2) WAP in Java to display the first 10 numbers of the Fibonacci series: 0,1,1,2,3,………
3) WAP to input twenty different numbers. Display the sum of those numbers which are
divisible by 3 as well 5.
4) Using a switch statement, write a menu driven program to:
a) Generate and display the first 10 terms of the Fibonacci series.
0,1,1,2,3,5,………………
The first two Fibonacci numbers are 0 and 1, and each subsequent number is the
sum of the previous two numbers.
b) Find and display the sum of the digits of an integer that is input.
Sample Input: 15390
Sample Output: Sum of the digits = 18
For an incorrect choice, an appropriate error message should be displayed.
5) WAP to input a number. Check and display whether it is a Niven number or not. (A
number is said to be Niven when it is divisible by the sum of its digits.)
Sample Input: 126
Sum of the digits = 1+ 2+ 6 =9 and 126 is divisible by 9.
6) Mr.Kumar is an LIC agent. He offers discount to his policy holders on the annual
premium. However, he also gets commission on the sum assured as per the given
tariff :
Sum Assured Discount Commission
Up to ₹ 1,00,000 5% 2%
₹ 1,00,001 to up to ₹ 2,00,000 8% 3%
₹ 2,00,001 to ₹ 5,00,000 10% 5%
More than ₹ 5,00,000 15% 7.5%
WAP to input the name of the policy holder, the sum assured and first annual
premium. Calculate the discount of the policy holder and the commission of the
agent. The program displays all the details as:
Name of the policy holder: ……………………………
Sum assured: …………………………………….
Premium: …………………………………….
Discount on the first premium: ………………………….
Commission of the agent: …………………………..
7) WAP in Java to display the given pattern:
54321
4321
321
21
1
8) WAP in Java to display the given pattern:
1
10
101
1010
10101
9) WAP to input a number. Calculate and display the factorial of each digit.
Sample Input:365
Factorial of 5= 120
Factorial of 6= 720
Factorial of 3= 6
10) WAP to accept two angles. Calculate and display whether they are ‘Complimentary
Angles’ or ‘Supplementary Angles’ as per the user’s choice.
[Hint: Enter ‘c’ for complementary or ‘s’ for supplementary]