0% found this document useful (0 votes)
2 views2 pages

Worksheet and Assignment

The document outlines a computer programming worksheet consisting of two parts. Part 1 requires the development of flow charts for various programming problems, while Part 2 involves writing C++ code to solve similar tasks. The topics range from basic number operations to more complex functions and control structures.

Uploaded by

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

Worksheet and Assignment

The document outlines a computer programming worksheet consisting of two parts. Part 1 requires the development of flow charts for various programming problems, while Part 2 involves writing C++ code to solve similar tasks. The topics range from basic number operations to more complex functions and control structures.

Uploaded by

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

Computer programming worksheet and assignment

Part1: For each of the problems below, develop a flow chart


1. Receive a number and determine whether it is odd or even.
2. Obtain two numbers from the keyboard, and determine and display
which (if either) is the larger of the two numbers.
3. Receive 3 numbers and display them in ascending order from smallest to largest
4. Add the numbers from 1 to 100 and display the sum
5. Find the average of two numbers given by the user.
7. Find the average, maximum, minimum, and sum of three numbers given by the user.
8. Find the area of a circle where the radius is provided by the user.
9. Swap the contents of two variables using a third variable.
10. Read 10 integers from the keyboard in the range 0 - 100, and count how many of them are
larger than 50, and display this result.
11. Take an integer from the user and display the factorial of that number
Part II For each of the problems write a C++ code to perform the required task.
12. Receive a number and determine whether it is odd or even.
13. Obtain two numbers from the keyboard, and determine and display which (if either) is the
larger of the two numbers.
14. Receive 3 numbers and display them in ascending order from smallest to largest
15. Find the average, maximum, minimum, and sum of three numbers given by the user.
16. Find the area of a circle where the radius is provided by the user.
17. Swap the contents of two variables using a third variable.
18. Write a C++ program that counts the number of digits in an integer number. For example;
23,498 has five digits.
19. Write a C++ application that can compute the letter grade of a student after accepting the
student’s mid and final mark. The program should only accept mid result [0-40] and final [0- 60].
If the data entered violates this rule, the program should display that the user should enter the mark
in the specified range. The program is also expected to run until the user refuses to continue.
20. write a program to print the following output, using a nested for loop.
*
***
*****
***
*
21. Use either a switch or an if-else statement and display whether a vowel or a consonant character
is entered by the user. The program should work for both lower case and upper-case letters.
22. Write a C++ code to display only even numbers found between 0 and 20.
23. Write a float function triangle () that computes the area of a triangle using its two
formal parameters h and w, where h is the height and w is the length of the bases
of the triangle.
24. The formula for a line is normally given as y = mx + b. Write a function Line() that expects
three float parameters, a slop m, a y-intercept b, and an x-coordinate x. the function computes the
y-coordinate associated with the line specified by m and b at x-coordinate.
Note: #1, #3, #8, #9, #11, #18, #19, #20, #23 and #24 are assignment questions.

You might also like