0% found this document useful (0 votes)
13 views14 pages

If-Else Exercises: Write A Program To Find Maximum Between Two Numbers

The document outlines a series of programming exercises focused on if-else statements. It includes tasks such as finding maximum values, checking number properties, calculating grades, and creating a simple calculator. Each exercise aims to reinforce logical thinking and programming skills through practical applications.

Uploaded by

Khin Myint
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views14 pages

If-Else Exercises: Write A Program To Find Maximum Between Two Numbers

The document outlines a series of programming exercises focused on if-else statements. It includes tasks such as finding maximum values, checking number properties, calculating grades, and creating a simple calculator. Each exercise aims to reinforce logical thinking and programming skills through practical applications.

Uploaded by

Khin Myint
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

If-else Exercises

1. Write a program to find maximum between two numbers

2. Write a program to find maximum between three numbers


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

4. Write a program to check whether a number is divisible by 3 or not


5. Write a program to check whether a number is even or odd

6. Write a program to check whether a character is alphabet or not (a to z or not)


7. Write a program to input any alphabet and check whether it is vowel or consonant

8. Write a program to input any character and check whether it is alphabet, digit or special
character
9. Write a program to check whether a character is uppercase or lowercase alphabet

10. Write a program to input week number and print week day
11. Write a program to input month number and print month Name
12. Write a program to input a product selling price and buying price then calculate profit or
loss

13. Write a program to input marks of five subjects Physics, Chemistry, Biology,
Mathematics and Computer. Calculate average and grade according to following:
 Percentage >= 90% : Grade A
 Percentage >= 80% : Grade B
 Percentage >= 70% : Grade C
 Percentage >= 60% : Grade D
 Percentage >= 40% : Grade E
 Percentage < 40% : Grade F
14. The marks obtained by a student in 5 different subjects are input through the
keyboard. The student gets a division as per the following rules: Write a program to
calculate the division obtained by the student
 Percentage above or equal to 60 - First division
 Percentage between 50 and 59 - Second division
 Percentage between 40 and 49 - Third division
 Percentage less than 40 – Fail
15. Write a program to calculate the salary as per the following table. (print out -
Salary)

Gender Year of Service Qualifications Salary

Male >= 10 Post - Graduate 15000

>= 10 Graduate 10000

< 10 Post - Graduate 10000

< 10 Graduate 7000

Female >= 10 Post - Graduate 12000

>= 10 Graduate 9000

< 10 Post - Graduate 10000

< 10 Graduate 6000


16. Find Youngest Age in Three of Student.
Eg: age - 21, 17, 19

17. Find the absolute value of a number entered through the keyboard.
(change negative number into positive number)
18. Write a program that accepts three numbers and check All numbers are equal or two
number are equal or all are different.

19. Write a program to create a simple calculator.


20. Write a program to check whether the given integer is a multiple of 5.

21. Write a program that accepts three numbers from the user and prints "increasing" if the
numbers are in increasing order, "decreasing" if the numbers are in decreasing order, and
"Neither increasing or decreasing order" otherwise.
Eg
num1 = 10;
num2 = 20;
num3 = 30;
output : Increasing Order
num1 = 30;
num2 = 20;
num1 = 10;
output: Decreasing Order
num1 = 30;
num2 = 5;
num1 = 10;
output: Neither Decreasing nor Increasing Order

You might also like