This document contains instructions for a lab on loops in C++. It includes 10 tasks of varying difficulties that involve writing programs to print sequences of numbers using for, while, and do-while loops. The tasks include printing odd numbers from a starting point, even numbers, numbers divisible by 2 and 3, a backward count, numbers incrementing by 5, even numbers from 0, odd numbers starting from 1, the first 10 square numbers, and calculating a factorial.
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 ratings0% found this document useful (0 votes)
177 views3 pages
Introduction To Computing - CSCS1514
This document contains instructions for a lab on loops in C++. It includes 10 tasks of varying difficulties that involve writing programs to print sequences of numbers using for, while, and do-while loops. The tasks include printing odd numbers from a starting point, even numbers, numbers divisible by 2 and 3, a backward count, numbers incrementing by 5, even numbers from 0, odd numbers starting from 1, the first 10 square numbers, and calculating a factorial.
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
You are on page 1/ 3
Introduction to Computing - CSCS1514
Lab Manual ITC LAB Booklet
Faculty of Information Technology
UCP Lahore Pakistan Lab 05 Topic Loops Statement Objectiv Working with for, while, do-while loops. e
Lab Task 1 (Easy)
Write a C++ program that will print 10 odd integer starting from ‘a’ ’ where ‘a’ is user defined number.
Lab Task 2 (Easy)
Write a C++ program that will print 10 even integers starting from ‘a’ ’ where ‘a’ is user defined number.
Lab Task 3 (Easy)
Write a C++ program that will print 10 integers starting from ‘a’ and divisible by 2 and 3, where ‘a’ is user defined number.
Lab Task 4 (Easy)
Write a C++ program that will print 10 integers starting from ‘a’ and multiple of 2 and 3, where ‘a’ is user defined number.
Lab Task 5 (Easy)
Write a C++ program which will show backward counting from 100 to 50. Output: 100, 99, 98, 97… 50
Lab Task 6 (Easy)
Write a C++ program which will show (increment by 5) numbers from 0 to 100. Output: 0, 5, 10, 15, 20 … 100
Lab Task 7 (Easy)
Write a C++ program which will show first 50 Even numbers starting from 0. Output: 0, 2, 4, 6…
Lab Task 8 (Easy)
Write a C++ program which will show first 50 Odd numbers starting with 1. Output: 1,3,5,7,… Lab Task 9 (Medium) Write a C++ program which will show first 10 members of “series of square numbers”. Rule for series of square number is xn = n2. 1, 4, 9, 16… Lab Task 10 (Medium) Write a C++ program that will take a number as input and will display factorial of that number. Enter number: 4 Factorial is: 24 4! = 4! = 4 × 3 × 2 × 1 = 24