Expressing Algorithms-Selection

1. C program that accepts a positive integer and prints whether the number is even or odd.
2. C program that accepts a positive integer and prints whether it is divisible by 7 or not.
3. C program that accepts a positive integer and prints whether it ends with 7 or not.
4.C program that accepts a three digit positive integer and prints the sum of digits, product of digits and reverse of the number.
5. C program that accepts a three digit positive integer and prints whether it is Armstrong number or not.
6. C program that accepts marks(M) of a subject out of 100 and prints the class of student:
If M>=70 then class is Distinction
If M>=60 and M<70 then class is First class
If M>=50 and M<60 then class is Second class
If M>=40 and M<50 then class is Third class
If M<40 then class is Fail.

7. C program that accepts three integers and finds out the highest out of them.
8. C program that accepts principal amount, period, age of depositor, gender of depositor and calculates the final amount payable. The rate of simple interest is as follows:-

Gender Age Rate of Interest
Male 25-40 yrs 9.05 %
41-59 yrs 9.25 %
>=60 yrs 9.50 %
Female 25-40 yrs 9.15 %
41-59 yrs 9.35 %
>=60 yrs 9.60 %

9. C program that accepts three numbers that represent the coefficients of a quadratic equation and print the roots of the quadratic equation.
10. C program that accepts a digit from the user and depending on the digit entered displays suitable message as follows:-
If digit is 1 or 4 or 7 or 9 then message should be  “ Hello”
If digit is 2 or 3 or 6 or 8 then message should be  “ Welcome”
If digit is 0 or 5 then message should be “ Its fun learning C”
If user enters anything other than 0 to 9 then message should be  “ Exit”
11. C program that accepts one alphabet and prints the color name starting with that alphabet.
12. C program that accepts options from user. The options can be ‘+’ or ‘-‘ or ‘*’ or ‘/’. The program should also accept two integers and print the appropriate result depending on the option.
13. An electric power distribution company charges its domestic consumer as follows:-

Consumption units Rate of Charge
0-200 0.50 per unit
201-400 Rs.100 plus Rs.0.65 per unit excess of 200
401-600 Rs.230 plus Rs.0.85 per unit excess of 400
601-above Rs.390 plus Rs.1.00 per unit excess of 600

Program should read the units consumed for a customer and calculate the total bill.