PROGRAM LIST – (IF)
1. WAP to accept a character and check whether it is upper case alphabet or lowercase
alphabet or digit or other character
2. WAP to accept a character and check whether it is a Vowel or consonant.
3. WAP to accept a character and invert the case of the character. (If the character is
in uppercase convert to lowercase, if it is in lowercase then convert to uppercase.
Other characters to be retained as it is.
4. WAP to accept any 3 numbers from the user and find the greatest and smallest of
those numbers.
5. WAP to accept any 4 numbers from the user and find the greatest and smallest of
those numbers
6. WAP to accept the values of a, b, c in the quadratic equation of the form
and print the nature of roots ( equal, real , imaginary)
7. WAP to accept the values of a, b, c in a QE of the form
and print the roots of the QE ( equal, real , imaginary)
8. WAP to accept the number of units consumed and calculate the electricity
Units < =200 Rs.1.50 / unit
Units <= 500 Rs.2.75 / unit
Units <= 750 Rs.3.50 / unit
Units > 750 Rs.5.00 / unit
9. WAP to accept the number of units consumed and calculate the electricity
For the first 200 Units, Rs.1.50 / unit
For the next 300 Units Rs.2.75 / unit
For the next 250 units Rs.3.50 / unit
For the rest of the Units Rs.5.00 / unit
10. WAP to calculate the amount, the employee should get. Accept the name, number
of hours and rate/hour from the user. Assume the number of hours is always greater
than 50.
Single time payment for 1st 75 hours as number of hours x rate/hour
1.5 times for the next 10 hours
Double the rate for the remaining hours
11. WAP to calculate the commission when the name and sales is accepted from the
user. The conditions to calculate the commission is given below
Sales < 1000 -> No commission
1000 < sales < 5000 -> 2% of sales
5000 < sales < 10000 -> 3 % of sales
Sales >= 10000 -> 5% of sales
12. WAP to calculate the tax when total pay is given. The conditions are
If total pay < 1000, tax = 15% of total pay or Rs175, whichever is less
If total pay >= 1000 and <1800, tax = 18% of total pay or Rs.300 whichever is less
If total pay > 1800, 25% of total pay or 450 rs. Whichever is less.
13. Write a program to accept the hair and eye color of a person. If the eye color is
Blue and the hair color is Black then the person is “selected” for the play else “Rejected”.
14. Write a program to accept the date and month. If the date is 1 and the month is
“January” then print the message “HAPPY NEW YEAR”. If the date is 25 and the
month is “December” then print the message “MERRY CHRISTMAS”. For all other
combination print “HAVE A NICE DAY”
15. In a flower show, the committee is decided to have only Roses moreover they
wanted the rose to be in Red or white in colour only. Accept the name of a flower,
if the accepted flower is “Rose” then accept the colour of the flower. If the colour is
Red or white then print the message “SELECTED FOR THE FLOWER SHOW” else
display the message “SORRY”. If the flower is not Rose then print the message
“SORRY”
16. In a restaurant one Coffee and Tea are only available as Hot drinks and Limca and
Maaza as Cold drinks. Write a program to accept the choice from the user and print
whether the drink is AVAILABLE are NOT.
17. Write a program to accept a word and check whether it is a palindrome or not.
18. Write a program to accept a sentence and check whether the middle character is a
vowel or not if the length is odd .
19. Write a program to accept a sentence and also accept the lower and upper index
from the user. Print all the characters from the lower index to the upper index if
upper index is greater than lower index.