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

Loops Lab 13

The document contains a set of programming exercises in C++ focusing on for loops and while loops. It includes tasks such as printing natural numbers, creating multiplication tables, calculating sums and factorials, and validating passwords. Each section consists of five questions aimed at reinforcing loop concepts in C++.

Uploaded by

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

Loops Lab 13

The document contains a set of programming exercises in C++ focusing on for loops and while loops. It includes tasks such as printing natural numbers, creating multiplication tables, calculating sums and factorials, and validating passwords. Each section consists of five questions aimed at reinforcing loop concepts in C++.

Uploaded by

Roohan Khan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

A.

FOR LOOP (5 Questions)

Q1. Print Natural Numbers

Write a C++ program using a for loop to print all natural numbers from 1 to 10.

Q2. Multiplication Table

Write a C++ program using a for loop to display the multiplication table of a number entered by
the user.

Q3. Sum of First N Numbers

Write a C++ program using a for loop to calculate the sum of first N natural numbers.

Q4. Factorial of a Number

Write a C++ program using a for loop to find the factorial of a number entered by the user.

Q5. Count Digits

Write a C++ program using a for loop to count the number of digits in an integer entered by the
user.

B. WHILE LOOP (5 Questions)

Q6. Print Even Numbers

Write a C++ program using a while loop to print all even numbers between 1 and 20.

Q7. Reverse a Number

Write a C++ program using a while loop to reverse a given number.

Q8. Sum of Digits


Write a C++ program using a while loop to calculate the sum of digits of a number entered by
the user.

Q9. Password Validation

Write a C++ program using a while loop that repeatedly asks the user to enter a password until
the correct password is entered.

Q10. Menu-Driven Program

Write a menu-driven C++ program using a while loop that keeps running until the user selects
Exit.

You might also like