Lab 7 Loops Practice
Lab 7 Loops Practice
LAB # 7
Instructor Name: Faiza Khadim
Instructions:
You have to submit CPP files of the program in a folder, named your Registration Number.
You have to upload your lab tasks on CMS.
All program codes should be written in C/C++. Students should use Visual studio compiler
for coding.
Indent and comment your code.
Use meaningful variable names
Plan your code carefully on a piece of paper before you implement it.
Learning Objectives:
Demonstrate knowledge of basic concepts of Loops (for and while) in programming C++
Recall previously learned basic concepts
Understanding problem statements and designing an appropriate solution
Solve different problems using selection statements.
Write a C++ program that takes two positive integers a and b as input from the user and displays the
value of ab. (Note: Do not use any built-in function for this purpose). a and b can be negative.
Expected Output
Enter the value of a: 2
Enter the value of b: 3
Power = 23= 8
Write a C++ program that takes a positive integer as input from the user and counts the number of
digits in that integer.
Expected Output
Enter a digits=45856
Digits in 45856= 5
End of LAB 7 😊