Assignment 2 (If Else If Ladder)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

LIST OF PROGRAMS- ASSIGNMENT 2

If else if (ladder) and switch case

Q1.Write a program to check whether a is positive, negative, or zero .


Q2. Write a program to check whether a number is even or odd.
Q3. Write a program to check the greatest of two numbers.
Q4. Write a program to check the eligibility of voting.
(condition is if Age >=18 ,person is eligible ) using conditional operation
Q5. Write a program to check whether two numbers are equal or not.
Q6. Write a program to check whether an employee is senior accountant
Accountant, computer operator, typist or peon.
Input BS, calculate DA, HRA, IT,PF . DA= 25% OF BS , HRA= 15% OF BS
IT=10% OF BS, PF =5% OF BS . Calculate net salary and find the post
of employee.
If NS>=80000, Senior Accountant, If NS>=60000, Accountant .
If NS>=40000, Computer Operator, If NS>=20000, Typist else If NS<20000, Peon.
Q7. Write a program to check whether the student stood first ,second , third or fail
in PCM.
>80% ---- first position
>60% ----- second position
>40% ----- third position
<40% ----- Fail
Q8. Write a program to find whether the gender in male, female or Transgender.
Q9. Write a program to check whether character entered is vowel or consonant.( using logical
operators and if else statement ).
Q10. Write a program to find the day week from character entered by the user.
Q11. Write a program to check whether the two names entered by the user are
similar or not.
Q12. Write a program to find the greatest of three numbers using else if and logical
operators.
Q13 Write a program to enter the gender and age and then find the eligibility for
marriage. Eligibility condition ( Male>=21 and Female>=18 )
Q14. Write a program to read the roll number , marks of three subjects .Calculate
the average and display the result according to average
IF average >= 60 grade A
IF 50<= Average <60 grade B
IF 40<= Average <50 grade C
IF Average <40 reappear
Q15. Write a program to calculate the electricity bill , A surcharge of 20% is applicable
on total bill
0-50 units – 0.50per unit
51- 150 units – 0.75per unit
151-250 units - 1.20 per unit
250 units – 1.50 per unit
Q16. Write a program to check whether the year is leap or not .(If divisible by 4, then leap year.
Further it should be divisible by 100, should be divisible by 400 , then leap year.
Ex- 1600 is leap year but 1500 is not leap year.
Q17. Write a program to display the day of week depending upon the first character of day
entered by user.
Q18. Write a program to check the character whether the character entered is vowel or not
using switch only
Q19. Write a program to perform the calculation (addition, subtraction, multiply, division )
as the symbol entered (using switch statement)
Q20. Write a program to find the number of days in the month according to the month
number entered by the user (using switch statement)
Q21. Write a program to find the area any switch statement
1. Area of circle
2. Area of Rectangle
3. Area of right angled triangle.

*******************------------------------------------------------**************************

You might also like