0% found this document useful (0 votes)
17 views1 page

Worksheet 2

This document is a worksheet for a Basic Computer Programming course at the University of Gondar. It outlines various programming tasks in C++ that students must complete, including determining odd/even numbers, comparing two numbers, sorting three numbers, calculating sums and averages, and more. The tasks are designed to reinforce programming concepts based on flow charts created in a previous worksheet.

Uploaded by

muhamme
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)
17 views1 page

Worksheet 2

This document is a worksheet for a Basic Computer Programming course at the University of Gondar. It outlines various programming tasks in C++ that students must complete, including determining odd/even numbers, comparing two numbers, sorting three numbers, calculating sums and averages, and more. The tasks are designed to reinforce programming concepts based on flow charts created in a previous worksheet.

Uploaded by

muhamme
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/ 1

University of Gondar

College of Informatics
Worksheet 2
Course Title: Basic Computer Programming / Fundamentals of Programming
Course No: CoSc 1011
For each of the problems write a C++ code to perform the required task. Your
program should be based on the flow chart you drawn in the first worksheet.
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. Add the even numbers between 0 and any positive integer number given by the
user.
6. 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. Swap the content of two variables without using a third variable.
11. Read an integer value from the keyboard and display a message indicating if
this number is odd or even.
12. 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
13. Take an integer from the user and display the factorial of that number

Compiled by: Melsew Belachew


College of Informatics, University of Gondar

You might also like