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

Sample Problem Looping

The document outlines six programming problems to be solved using C++. The problems include printing numbers, even numbers, countdowns, calculating sums, generating multiplication tables, and finding factorials. Each problem specifies the required output format and includes sample inputs and outputs.
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

Sample Problem Looping

The document outlines six programming problems to be solved using C++. The problems include printing numbers, even numbers, countdowns, calculating sums, generating multiplication tables, and finding factorials. Each problem specifies the required output format and includes sample inputs and outputs.
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

1.

Print Numbers from 1 to 10

Problem:
Write a C++ program that prints numbers from 1 to 10 using a for loop.

Sample Output:

1 2 3 4 5 6 7 8 9 10

2. Print Even Numbers from 1 to N

Problem:
Ask the user to enter a number N. Print all even numbers from 1 to N using a while loop.

Sample Input:

Enter N: 10

Sample Output:

2 4 6 8 10

3. Countdown Program

Problem:
Create a program that prints a countdown from 10 to 1 using a do-while loop.

Sample Output:

10 9 8 7 6 5 4 3 2 1

4. Sum of First N Natural Numbers

Problem:
Ask the user to input a number N. Calculate and display the sum of the first N natural numbers.

Sample Input:

Enter N: 5

Sample Output:

Sum = 15
5. Multiplication Table

Problem:
Display the multiplication table of a number entered by the user (from 1 to 10).

Sample Input:

Enter number: 3

Sample Output:

3 x 1 = 3
3 x 2 = 6
...
3 x 10 = 30

6. Factorial of a Number

Problem:
Write a program that calculates the factorial of a number using a loop.

Sample Input:

Enter number: 5

Sample Output:

Factorial = 120

You might also like