1) Write a program to input three angles of a triangle and check whether a triangle is possible or not.
If possible then check whether it is an acute angled triangle, right-angled triangle or an obtuse-angled
triangle. Otherwise display “Triangle not possible”.
Sample Input : Enter three angles : 40, 50, 90
Sample Output: Right-Angled Triangle.
2) Write a program to input the cost prince and the selling price of an article. If the selling price is
more than the cost price then calculate and display the actual profit and profit percent otherwise,
calculate and display actual loss and loss percent. If the cost price and the selling price are equal, the
program displays the message “Neither profit nor loss”.
3) Write a program to input three numbers and check whether they are equal or not. If they are
unequal numbers then display the greatest among them. Otherwise, display the message “All the
numbers are equal”.
Sample Input: 34, 87, 61
Sample Output: 87
Sample Input: 81,81,81
Sample Output: All the numbers are equal.
4) Write a program to accept a number and check whether the number is divisible by 3 as well as 5.
Otherwise decide:
a) Is the number divisible by 3 and not by 5?
b) Is the number divisible by 5 and not by 3?
c) Is the number divisible by 3 nor by 5?
The program displays the message accordingly.
5) Write a program to input year and check whether it is:
a) Leap year b) A century leap year c) A century year but not a Leap year.
Sample Input: 2000
Sample Output: It is a Century Leap Year
6) Write a program to input two unequal positive numbers and check whether they are perfect square
numbers or not. If the user enters a negative number then the program displays the message ‘Square
of a negative number can’t be determined’.
Sample Input: 81,100
Sample Output: They are perfect square numbers
Sample Input: 225,99
Sample Output: 225 is a perfect square number
99 is not a perfect square number
7) Without using if-else statement and ternary operators, accept three unequal numbers and display
the second smallest number.
Sample Input: 34,82,61
Sample Output: 61
8) Write a program to input three unequal numbers. Display the greatest and the smallest number.
Sample Input : 28, 98, 56
Sample Output: Greatest number: 98
Smallest number: 28
9) A pre-paid taxi charges from the passenger as per the tariff given below:
Distance Rate
Up to 5km Rs.100
For the next 10km Rs.10/km
For the next 10km Rs.8/km
More than 25km Rs.5/km
Write a program to input the distance covered and calculate the amount paid by the passenger. The
program displays the printed bill with the details given below:
Taxi No. : _______________
Distance Covered: _______________
Amount : _______________
10) A cloth showroom has announced festival discounts and the gifts on the purchase of items, based
on the total cost as given below:
Total Cost Discount Gift
Upto Rs.2,000 5% Calculator
Rs.2001 to Rs.5000 10% School Bag
Rs.5001 to Rs.10,000 15% Wall clock
Above Rs.10,000 20% Wrist watch
Write a program to input the total cost. Compute and display the amount to be paid by the customer
along with the gift.
11) Given below is a hypothetical table showing the rate of income tax for an Indian citizen, who is
below or up to 60 years.
Taxable Income (in Rs) Income Tax (in Rs)
Up to Rs.2,50,000 Nil
More than Rs.2,50,000 and less than
10% on the income exceeding Rs.2,50,000
or equal to Rs.5,00,000
More than Rs.5,00,000 and less than 20% on the income exceeding Rs.5,00,000 plus an
or equal to Rs.10,00,000 additional Rs.34,000
30% on the income exceeding Rs.10,00,000 plus and
More than Rs.10,00,000
additional Rs.94,000
Write a program to input the name, age and taxable income of a person. If the age is more than 60
years then display the message “Wrong Category”. If the age is less than or equal to 60 years then
compute and display the income tax payable along with the name of the tax payer as per the table
given above.
12) An employee wants to deposit certain sum of money under “Term Deposit” scheme in Syndicate
Bank. The bank has provided the tariff of the scheme, which is given below:
No. of days Rate of Interest
Upto 180 days 5.5%
181 to 364 days 7.5%
Exact 365 days 9.0%
More than 365 days 8.5%
Write a program to calculate the maturity amount taking the sum and number of days as inputs.
13) 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 Rs.1,00,000 5% 2%
Rs.1,00,001 and up to Rs. 2,00,000 8% 3%
Rs.2,00,001 and up to Rs.5,00,000 10% 5%
More than Rs.5,00,000 15% 7.5%
Write a program to input the name of the policy holder, the sum assured and the 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 :
14) A company announces revised Dearness Allowance(DA) and Special Allowances (SA) for their
employees as per the tariff given below:
Basic Dearness Allowance (DA) Special Allowances(SA)
Up to Rs.10,000 10% 5%
Rs.10,001 to Rs.20,000 12% 8%
Rs.20,001 to Rs.30,000 15% 10%
Rs.30,001 and above 20% 12%
Write a program to accept name and basic salary (BS) of an employee. Calculate and display gross
salary.
Gross Salary = Basic + Dearness allowance + Special allowance
Print the information in the given format:
Name Basic DA Spl. Allowance Gross Salary
15) Using a switch case statement, write a menu driven program to convert a given temperature from
Fahrenheit to Celsius and vice-versa. For an incorrect choice, an appropriate message should be
displayed.
Hint: c=5/9 * (f-32) and f=1.8*c +32
16) The volume of solids, viz cuboid, cylinder and cone can be calculated by the formula:
1. Volume of a cuboid (v =l*b*h)
2. Volume of a cylinder (v=Pi *r2 * h)
3. Volume of a cone (v=1 * Pi * r2 * h)
3
Using a switch case statement, write a program to find the volume of different solids by taking
suitable variables and data types.
17) A Mega shop has different flows which display varieties of dresses as mentioned below:
1. Ground floor : Kids wear
2. First floor : Ladies wear
3. Second floor : Designer sarees
4. Third floor : Men’s wear
The user enters floor number and gets the information regarding different items of the Mega Shop.
After shopping, the customer pays the amount at the billing counter and the shopkeeper prints the bill
in the given format:
Name of the Shop : City Mart
Total Amount : ____________________
Visit Again!!!
Write a program to perform the above tasks as per the user’s choice.
18) The equivalent resistant of series and parallel connections of two resistances are given by the
formula:
a) R1 = r1+ r2 (Series)
b) R2 = r1* r2
r1+ r2 (Parallel)
Using a switch case statement, write a program to enter the value of r1 and r2. Calculate and display
the equivalent resistances accordingly.
19) The Simple Interest (SI) and Compound Interest (CI) of a sum (P) for a given time (T) and rate
(R ) can be calculated as :
a) SI = p*r*t
100
b) CI = P * ( (1 + R/100)T -1 )
Write a program to input sum, rate, time and type of interest (‘S’ for Simple Interest and ‘C’ for
Compound Interest). Calculate and display the sum and the interest earned.
20) ‘Kumar Electronics’ has announced the following seasonal discounts on purchase of certain
items.
Purchase Amount Discount on Laptop Discount on Desktop PC
Up to Rs.25000 0.0% 5.0%
Rs.25,001 to Rs.50,000 5.0% 7.5%
Rs.50,001 to Rs.1,00,000 7.5% 10.0%
More than 1,00,000 10.0% 15.0%
Write a program to input name, amount of purchase and the type of purchase (‘l’ for Laptop and ‘D’
for Desktop ) by a customer. Comput and print the net amount to be paid by a customer along with
his name.
(Net amount = Amount of purchase – discount )