✅ 20 C++ Programming Questions (Statement Form)
1. Basic Input & Output
1. Write a C++ program that asks the user to enter their age and then prints whether they
are a child, teenager, or adult using if-else conditions.
2. Loops (for / while / do-while)
2. Write a C++ program that prints all even numbers from 1 to 100 using a for loop.
3. Write a C++ program that takes a number from the user and uses a while loop to print
its multiplication table.
4. Write a C++ program that keeps asking the user for a password using a do-while loop
until the correct password “1234” is entered.
5. Write a C++ program to calculate the sum of the first N natural numbers using a for
loop.
3. Decision Making
6. Write a C++ program that takes a number from the user and prints whether it is
positive, negative, or zero using if-else.
7. Write a C++ program that takes marks of three subjects and prints the percentage and
grade.
4. 1D Array Questions
8. Write a C++ program that takes 5 numbers in an array and prints the largest number.
9. Write a C++ program that takes 10 numbers in an array and counts how many numbers
are even and how many are odd.
10.Write a C++ program that takes 8 elements in an array and prints them in reverse
order.
11.Write a C++ program to search a number in an array of 10 elements (linear search).
12.Write a C++ program that calculates the sum and average of values stored in an array
of 7 integers.
13.Write a C++ program that creates an array of 5 integers and prints only the prime
numbers from the array.
5. 2D Array Questions
14.Write a C++ program to store marks of 3 students in 3 subjects using a 2D array, then
print the total marks of each student.
15.Write a C++ program that multiplies two 2D arrays (matrices) and prints the resulting
matrix.
16.Write a C++ program to take a 3×3 matrix from the user and print the sum of all
elements.
17.Write a C++ program that counts how many numbers in a 3×3 matrix are greater than
50.
18.Write a C++ program that prints the main diagonal elements of a 3×3 matrix.
6. Mixed Logic Practice
19.Write a C++ program that grades an arithmetic quiz as follows:
a) Ask the user how many questions are in the quiz.
b) Ask each question and take the user’s answer.
c) Count how many answers are correct and show the score.
20.Write a C++ program that repeatedly asks the user to enter a number. Stop when the
user enters 0, and then print the sum of all entered numbers.
10 C++ Problem Statements (Loops +
If-Else + Arrays)
1. 1D Array – Even/Odd Counter
Write a C++ program that takes 10 integers in an array, then uses a for loop and if-else to
count and print how many numbers are even and how many are odd.
2. 1D Array – Maximum Value
Write a C++ program that stores 7 integers in an array and uses a loop to find the largest
number using if conditions.
3. 1D Array – Positive/Negative Check
Write a C++ program that inputs 8 numbers in an array and prints how many are positive,
negative, and zero using loops and if-else.
4. 1D Array – Search a Number
Write a C++ program that takes 10 numbers in an array and uses a loop + if condition to
check whether a given number exists in the array.
5. 1D Array – Count Numbers Greater Than 50
Write a C++ program that stores 12 integers in an array and prints how many values are
greater than 50 using a loop and if-else.
6. 2D Array – Count Even Numbers
Write a C++ program to input a 3×3 matrix and use nested loops + if conditions to count how
many values in the matrix are even.
7. 2D Array – Sum of Elements Less Than 20
Write a C++ program that inputs a 4×4 array and uses loops + if to calculate the sum of all
elements less than 20.
8. 2D Array – Print Elements Above Diagonal
Write a C++ program that takes a 3×3 matrix and uses loops + if-else to print only those
elements where column > row (above the main diagonal).
9. 1D Array – Pass/Fail Result
Write a C++ program that stores marks of 5 students in an array and uses a loop + if-else to
count how many students passed and how many failed (pass marks ≥ 40).
10. Mixed Logic – Temperature Categories
Write a C++ program that records 10 daily temperatures in an array and uses loops +
if-else to count how many days were hot (>35), normal (20–35), or cold (<20).