You are on page 1of 3

If Statement

27. W.A.P accept two numbers and find Max & Min out of 2.
28. W.A.P accept two numbers and find Max & Min out of 3.
29.W.A.P to check if the number is Odd or even.
30. W.A.P to accept N and Check if it is positive/negative or zero.
31. W.A.P to accept N and Check if it is 1 digited/ 2 digited/ 3 digited or greater.
32. W.A.P to accept N and Check if it is divisible by 5 and 7 or not.
33. W.A.P to accept N and Check if it is palindrome number or not (121, 343, etc).
34. W.A.P to accept N and Check if it is Armstrong number or not (153).
35. W.A.P to accept N number find the sum and check whether it greater than 1000 or not.
36. A function f is defined as follows:
f(x) = ax3 - bx2 + cx - d if x > k,
= 0 if x = k &
= -ax3 + bx2 - cx + d if x < k
Write a program that reads a, b, c, d, k and x and prints the value of f(x).

37. W.A.P to accept marks of 6 subject


• Find the total
• Find the Percentage
• Find the grade according to the given table

Percentage Grade
80 to 100 Honours
60 to 79 First Class
50 to 59 Second Class
40 to 49 Third Class
0 to 39 Fail

38. An electric power distribution company charges its domestic consumers as follows:

Consumption Units Rate of Charge


0-100 Rs. 0.75 per unit
101 –300 Rs. 75 plus Rs. 1.00 per unit excess of 100
301 –500 Rs. 275 plus Rs. 1.50 per unit excess of 300
500 and above Rs. 575 plus Rs. 1.75 per unit excess of 500

Write a program that read customer number & power consumed and prints the amount
to be paid by the customer. Note that output should be well formatted.
39. A manufacturing company classified its executives into four levels for the benefit of
certain perks. The levels and corresponding perks are shown below:

Perks
Levels
Conveyance Entertainment
Allowance Allowance
1 2000 600
2 700 400
3 400 200
4 150 100

An executive’s gross salary includes basic pay, house rent allowance at 25% of basic pay
and other perks. Income tax in withheld from the salary on a percentage basis as
follows:

Gross Salary Tax Rate


Gross <= 2000 No tax deduction
2000 < Gross <= 4000 3%
4000 < Gross <= 5000 5%
Gross > 5000 8%

Write a program that will read an executive’s job number, level number and basic pay
and then compute the net salary after withholding Income tax.

40. The commission a life-insurance saleswomen earns on insurance polices sold is as follows:

Policy Amount (Rs.) Commission


Less or equal to 10,000 ½ % of policy amount
Between 10,000 and 25,000 Rs. 50 + 0.6% of the amount in excess of Rs. 10,000/-
Greater or equal to 25,000 Rs. 140 + 0.75% of the amount in excess of Rs. 25,000.
Write a program that reads the amount of insurance sold and outputs the commission due to
the saleswomen.

41. A library pays overtime to its staff as per the following schedule:

If the basic salary of a worker is less than Rs. 2,500/- per month, her overtime allowance
is Rs. 10/- per hour for the first 10 hours and Rs. 7.50 per hour for hours in excess of 10,
up to a maximum of Rs. 750/-per month. If the basic salary is in excess of Rs. 2,500/- per
month but less than 3,500/- per month, the overtime allowance is Rs. 15/- per hour for
the first 10 hours, and Rs. 10 per hour for hours in excess of 10, up to a maximum of Rs.
1250/- per month. If the basic salary is in excess of Rs. 3,500/- per month, the overtime
allowance is Rs. 20/- per hour for the first 10 hours and Rs. 15 per hour for hours in
excess of 10, up to a maximum of Rs. 1500/- per month.
Write a program to read a worker’s basic salary and overtime hours and to compute and print
the gross salary.

42. The offshore gas company bills its customers according to the following rate schedule :

First 50 cm Rs. 40 (flate rate)


Next 300 cm Rs. 1.25 per 10 cm
Next 3000 cm Rs. 1.20 per 10 cm
Next 2500 cm Rs. 1.10 per 10 cm
Next 2500 cm Rs. 0.99 per 10 cm
Above this Rs. 0.80 per 10 cm.

Write a program that reads customer number, previous meter reading and new meter reading.
Then program should print the following information in appropriate format:
Customer number, Previous meter reading, New meter reading, Gas used, Total Bill.

43. Write a program that read a number between 1 to 7 (including both) and then print
corresponding day name from the week. For example,

if entered number is 1, then print “Today is Monday”,


if entered number is 2, then print “Today is Tuesday”,
if entered number is 3, then print “Today is Wednesday”, and so on.

You might also like