Computer Programming Asst_II
Computer Programming Asst_II
Using
Assignment II
Practical Assignment on Control Statement
1. Write a C++ program to read any three numbers and print the largest and the average value
of it
2. Write a C++ program to read a number and check if it’s positive, negative or zero, even or
odd and print a word that tells us above the number, add it to a total, decrement it by 2 and
display suitable messages in each case (total and new value after decrement)
3. Write a C++ program to read a student result, and check if it’s result greater than or equal to
90, then print A+, greater than or equal to 75, then print A, greater than or equal to 50, then
print A-, otherwise print fail
4. Write a C++ program to read a number from 1 to 7, and print the day of the week from
Sunday to Monday
5. Write C++ program to read integer number, and print the name of the departments of AAU
in 4 kilo campus
6. Write C++ program to read two integer numbers then check if one number is a multiple to
another number and print “Multiple” or “Not”
7. Write C++ program to read integer number and print the equivalent string. For example if
you write 0 the output must be Zero
8. Write C++ program that represent a simple nested case (selector).
9. Write C++ program to reads a character and print if it is digit (0..9), capital letter (A,B, …
,Z), small letter (a, b, … ,z), special character ( +, !, @, #, , {, >, … ).
1
10. Write C++ program to read x and compute the following:
a. Y= (X2+5X-20)/(X+1) if X >0
b. Y=0 if X =0
2
c. Y= (X +(5X)2-10) if X <0
11. Write C++ program to find the summation of the following series: Sum= 1+3+5+7+ . . . . . .
. . +99
12. Write C++ program to read 10 integer numbers, and find the sum of the positive numbers
only.
13. Write C++ program to find the summation of the following series :
14. Write C++ program to enter a number represents a centigrade
degree. Find degree in Fahrenheit that generated from the first degree according to the
relation: F= (9/5) * C +32. Then display the below phrases according to their equivalent
Fahrenheit degree:
1. “Cold” when F ≤ 41.
2. “Nice” when 41< F ≤ 77.
3. “Hot” when F >77.
15. Write a C++ program to choose your country. The program contains a list of cities (Addis
Ababa, Dire Dawa, Hawas, Mekele, Adama and Bahirdar). When we choose any of these
countries, the city center of these countries is displayed. The countries will represented from
(0) to (4) and sixth city will be any number except these five numbers.
16. Write a C++ program to enter a string then display the message boxes "Greater than 7
characters", "Less than 7 characters", and "Equal to 7 characters" if this number was greater,
less, and equal to seven characters respectively.
17. Write a C++ program to enter a number represents a person age then display the following
on a message boxes:
1. "Wrong age" if the age less than or equal to 0 years.
2. "Child" if the age less than 8 years.
3. "Boy" if the age greater than or equal to 8 years.
4. "Young" if the age greater than or equal to 18 years.
5. "Old" if the age greater than or equal to 35 years.
6. "Very Old" if the age greater than or equal to 65 years.
2
18. Write a C++ program to enter a character represent the person gender (M: for male, F: for
female) and a number represents person length ((L) in centimeter) then find and print its
perfect weight ((W) in Kilogram) according to the following relations:
For male (M) : W = (L × 4) - 125
For female (F): W = (L × 3.5) – 108
19. Suppose Commercial Bank of Ethiopia offers 10% interest on balances of less than Birr
10000, 15% for balances of Birr 10000 or more but less than Birr 20000, and 20% for
balances of Birr 20000 or more. Write a C++ program to enter a person balance then
calculates a customer’s new balance after one year.
20. Write a program in C++ to print the numbers between 1 and 50 using while, do.. while and
for statement?