Worksheet One
Worksheet One
Worksheet I
1. Define the following terms:
Programmer Compiler
Programming languages
2. Develop an algorithm for each of the following problems. Use flowchart and
a) Converts a mark for a course to its corresponding letter-grade. (You may set
d) Counts and displays the number of even and odd occurrences in a given list
of integers.
f) Finds the minimum and maximum numbers from a given list of numbers.
i) Accepts two numbers and displays the product, sum, and difference of the
two numbers.
k) Accepts a positive number form the keyboard and displays the value of the
following series.
4. Describe the three kinds of program errors using examples for each kind?
(reserved) identifiers.
9. Explain what variables and constants are and describe their difference.
10. List out the types of operators used in C++. List out the five arithmetic operators and
11. Explain the difference between unary minus and binary minus using examples.
Programming questions
1. Compute the value of each legal C++ arithmetic expression. If the expression is not
legal, explain why. Clearly indicate what the data type of the result of each
a) (1.0 / 4) * 6
b) (6 * 3) % 5
c) (3 / 4) * 4
d) (4.0 * 2) % 5
e) ((10 + 5 / 2) / 3)
Start
Display NetSalary
3. Write a program in C++ that calculates and displays the areas of the following
geometric figures. Note: Your program should ask the user for which figure type the
a) Circle
b) Triangle
c) Rectangle
4. Write a program that swaps (assign the value of one for the other and vice versa) the
values of two variables and displays their former and current values. The values of
5. Write a program that tells whether a number entered from the keyboard is an even
or an odd number.
6. Write a program that tells whether a number entered from the keyboard is a positive
7. Write a program that accepts a character from the keyboard and displays its ASCII
code.
8. Write a program that tells whether a character entered from the keyboard is in
9. Write a program that converts a letter entered from the keyboard to its uppercase or
10. Write a program that accepts a character entered from the keyboard and tells
11. Write a program in C++ to find the simple interest for a given principal, rate of
12. Write a program in C++ to solve a quadratic equation. Hint: your program should
13. Write a program in C++ to find the compound interest for a given principal, rate of
14. Write a program in C++ to read a positive integer number n from a standard input
device to display the number and digit. For example for n= 2345 your program
should display the digits 2 3 4 and 5. Use the ‘/t’ to insert a space between the digits.
15. Write a program that accepts a character entered from the keyboard and tells
16. Write a program that converts a temperature given in Fahrenheit into Celsius and
vice versa. The program should distinguish temperature entered from the keyboard
must be written in front of the numeric values of temperatures. For example: - If the
user enters 10 c or 10 C, the program must understand that the input is in degree
temperature as 50 f or 50 F.
17. Write a program that requests the user to input his/her height in cms and weight in
kg from the keyboard and tells the user whether he/she is balanced, underweight or
overweight. A balanced person must weight in the range of x + (10 percent of x).
18. Write a program that calculates and displays the income tax of a salary entered from
the keyboard. Your program must calculate taxes according to the following rates:
Up to 200Br 0%
200Br – 600Br 10%
600Br – 1200Br 15%
1200Br – 2000Br 20%
2000Br – 3500Br 25%
3500Br & above 30%
For example:- The income tax of a gross salary of 900 Birr is 85 Birr, which is
calculated as (200*0% + 400*10% + 300*15%)=85 Birr.
19. Write a program that tells the number of days found in the months of a European
calendar. Where the month and the year are to be entered from the keyboard. Your
program must consider leap year condition along with other conditions.
date entered from the keyboard. Your program must consider leap year condition,
For example: - The next date of 24/10/2024 must be computed and displayed as
25/10/2024.
21. Write a program that tells the number of days found in the months of a European
calendar. Where the month and the year are to be entered from the keyboard. Your
program must consider leap year condition along with other conditions.
22. Write a program that converts a mark of a course entered from the keyboard to its
Mark Grade
>=90 A+
>=80 A
>=75 B+
>=60 B
>=55 C+
>=45 C
>=30 D
< 30 F