Computer Holiday Homework Class 10 ICSE 2023 - 24
Computer Holiday Homework Class 10 ICSE 2023 - 24
Programming Assignment
Class – X (Session 2023 – 24)
1. The length in feet and inches are added as:
Let Length1 = 8 feet 7 inch
Let Length2 = 7 feet 10 inch
Sum of Length1 and Length2 = 16 feet 5 inch (where 12 inch = 1feet)
2. Write a program to input a character check if it is an alphabet then convert it into
uppercase form, if lowercase. Print the next five characters in circular alphabetical list
including the modified character if it is a consonant. Print the previous five characters in
circular alphabetical list including the modified character if it is a vowel.
Example: Input: w Output: WXYZA
Input: E Output: EDCBA
3. Write a menu driven program to display two options “Print day of week” OR “Name of the
month”. Your program should then ask for day number or month number on the basis of
the choice selected and the program should print either day of week or name of the month.
4. An electronic shop has announced the seasonal discounts on the purchase of certain
items.
Purchase amount in Rs. Discount on Laptop Discount on Desktop
0 – 25000 0.0% 5.0%
above 25000 – 57000 5.0% 7.5%
above 57000 – 100000 7.5% 10.0%
More than 100000 10.0% 15.0%
Write a program based on above criteria, to input name of customer, address of customer,
amount of purchase and type of purchase (L for Laptop and D for Desktop). Calculate and
print the net amount to be paid by the customer along with his/her name and address.
5. Write a program to enter 3 numbers in 3 different variables. Print numbers in ascending
or descending order as choice of user.
6. A Hotel has following special rates for stay depending upon number of days:
Number of days Rate per day
First 3 days Rs. 350
for next 3 days Rs. 300
for next 3 days Rs. 275
Any day beyond 9 days Rs. 225
Write a program to input name of person, number of days stayed, room number allotted,
check-in date and check-out date. Calculate checkout bill amount. Print name of person,
number of days stayed, room number, check-in date, check-out date and total amount to
be paid by the person.
7. A number is said to be prime if the number has only two factors i.e. the number is divisible
by 1 and itself only. Write a program to print Fibonacci terms which are prime in nature
upto n terms. ‘n’ is the limit of Fibonacci series which is given by the user as input.
1
8. SELF BANK HOME FINANCE revised its rate of interest for Public Deposits as:
Years Cumulative Interest Scheme Annual Income Scheme
(Compounded Annually)
1 ----- 10%
2 ----- 10.5%
3 11.5% 11%
4 11.75% 12%
5 12% 12.25%
Deposit under the cumulative scheme is accepted for a period between 3 to 5 years
Write a program to find the:
a. amount (A) due for sum (P) invested under the cumulative option scheme, by using
the formula A = P x (1+0.01xR)T
b. Interest (I) for each year, under the annual interest scheme, using the formula
I=0.01xPxR
The program should continue as long as the user wants.
9. Write a program to print those integers between 1 to n which are divisible by m. Also print
whether the number is that is divisible by m is even or odd. Input n as last limit and m as
divisor.
10. Input N and M as start and end limits. Print the factorial of all integers between N and M
if N<M, otherwise print a message “factorials not possible”.
11. Write a program to accept a choice (ch), limit of series (n) & base (x) and print sum of the
following series as per user’s choice.
if choice =1: sum = -1 + x2 /2! – 2x4 /4! + 3x6 /6! – 4x8 /8! ... nx2*n /(2*n)!
if choice =2: sum = (1*2 3) + (2*3 4) + (3*45) + (4*5 6).... 𝑛 𝑡𝑒𝑟𝑚𝑠
if choice =3: sum = 2x/4! – 4x2/8! + 6x3/12! – 8x4/16! + 10x5/20! – .... 𝑛 𝑡𝑒𝑟𝑚𝑠
if choice =4: sum = 1 + (x+2)/2! + (2x+3)/3! + (3x+4)/4! + .... 𝑛 𝑡𝑒𝑟𝑚𝑠
12. Write a program to print all Pythagorean triplet between1 to 100. A Pythagorean triplet is
the set of three consecutive numbers such that sum of square of first two numbers is equal
to the square of third number.
13. Create a function void finder (int x, int y): to find the GCD of x and y using Euclid’s method
(remainder method). Write a main method to input two numbers & print GCD.
Euclid’s Method.
Step 1: Decide the greater from two numbers.
Step 2: Divide the greater number by smaller number, if remainder is zero, print divisor
(smaller number) as GCD, otherwise
Step 3: Take divisor as number and remainder as divisor, and repeat Steps 2 and 3.
14. Define a class Number with three methods:
int maxDigit(long num): to find and return greatest digit of number stored in num.
int minDigit(long num): to find and return smallest digit of number stored in num.
void freq(long num): to print frequency of each digit of number stored in num.
15. Define a function void findVowel(char ch) that takes a character in ch and find its nearest
vowel if ch is not a vowel. Print original value of ch and its nearest vowel. Your program
should display and error message if original value of ch is not within A-Z or a-z.
16. Define a class Check to overload method primes()
int primes(int num) : returns -1 if number is composite or returns 1 if number is prime.
2
void primes(long num): print only prime digits of num.
void primes(int n, int m): To print whether number stored in n and m are prime or not if yes
then print whether n and m are Twin-Primes or not otherwise print suitable message. (Two
numbers are said to be Twin-Primes if both the numbers are prime & their difference is 2).
17. Design a program to overload a function triangle as follow to print three different patterns:
void triangle ( int n, char ch)
1*1
12*21
123*321
1234*4321
12345*54321