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

Sheet 5

The document contains a series of programming questions focused on C++ coding tasks. It includes converting loops, creating multiplication tables, calculating factorials, counting digits, and summing series. Each question requires the implementation of specific algorithms using loops and user input.
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)
7 views2 pages

Sheet 5

The document contains a series of programming questions focused on C++ coding tasks. It includes converting loops, creating multiplication tables, calculating factorials, counting digits, and summing series. Each question requires the implementation of specific algorithms using loops and user input.
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

Sheet 5

Q1-
Suppose the input is 2 3 4 5 0. What is the output of the following code?

Q2-
Convert the following while loop into a do-while loop.

Q3-
Convert the following while loop into a for loop.

Q4-
Write a C++ program that prompts the user to input an integer. Use a loop to print
the multiplication table for that number up to 10.
Sheet 5
Q5-
Write a C++ program that prompts the user to input an integer. Use a loop to print
the multiplication table for that number up to 10.

Q6-
Write a C++ program that takes a positive integer and calculates its factorial using
a loop.

Q7-
Write a C++ program that prompts the user to enter an integer and uses a loop to
count the digits in the integer.

Q8-
Write a C++ program that calculates the sum of all digits in a given integer.

Q9-
Write a C++ program that takes 10 integers from the user and determines the
maximum and minimum numbers in the list.

Q10-
Write a C++ program that calculates the sum of all even and odd numbers from 1
to n, where n is entered by the user.

Q11-
Write a C++ program that calculates the sum of the following series and displays
the result.
the series:
1 − 1/2 + 1/3 − 1/4 + . . .until a term is reached that is less than 0.0001.

------------------ End ------------------

You might also like