In: Computer Science
write pseudocode not c program
If- else programming exercises
1. Write a C program to find maximum between two numbers.
2. Write a C program to find maximum between three numbers.
3. Write a C program to check whether a number is negative, positive or zero.
4. Write a C program to check whether a number is divisible by 5 and 11 or not.
5. Write a C program to check whether a number is even or odd.
6. Write a C program to check whether a year is leap year or not.
7. Write a C program to check whether a character is alphabet or not.
8. Write a C program to input any alphabet and check whether it is vowel or consonant.
9. Write a C program to input any character and check whether it is alphabet, digit or special character.
10. Write a C program to check whether a character is uppercase or lowercase alphabet.
11. Write a C program to input week number and print week day.
12. Write a C program to input month number and print number of days in that month.
13. Write a C program to count total number of notes in given amount.
14. Write a C program to input angles of a triangle and check whether triangle is valid or not.
15. Write a C program to input all sides of a triangle and check whether triangle is valid or not.
16. Write a C program to check whether the triangle is equilateral, isosceles or scalene triangle.
17. Write a C program to find all roots of a quadratic equation.
18. Write a C program to calculate profit or loss.
19. Write a C program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer. Calculate percentage 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
20. Write a C program to input basic salary of an employee and calculate its Gross salary according to following:
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary <= 20000 : HRA = 25%, DA = 90%
Basic Salary > 20000 : HRA = 30%, DA =
95%
Answer 1
**********
READ n1,n2
IF n1>n2
WRITE "n1 is Maximum"
ELSE
WRITE "n2 is Maximum"
ENDIF
Answer 2
**********
READ n1,n2,n3
IF n1>n2 & n1>n3
WRITE "n1 is Maximum"
ELSEIF n2>n1 & n2>n3
WRITE "n2 is Maximum"
ELSE
WRITE "n3 is Maximum"
ENDIF
Answer 3
**********
READ n1
IF n1 > 0
WRITE "n1 is Positive"
ELSEIF n1 < 0
WRITE "n1 is Negative"
ELSE
WRITE "n1 is Zero"
ENDIF
Answer 4
*********
READ n1
IF (n1 % 5 =0) & (n1 % 11 = 0)
WRITE "n1 is divisible by 5 & 11"
ELSE
WRITE "n1 is not divisible by 5 & 11"
ENDIF
We are allowed to do only 4 exercise out of any given.
if you have any doubt then please ask me without any hesitation in the comment section below , if you like my answer then please thumbs up for the answer , before giving thumbs down please discuss the question it may possible that we may understand the question different way and we can edit and change the answers if you argue, thanks :)