Lab Exercise 6

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

SCHOOL OF GENERAL AND FOUNDATION STUDIES

AIMST UNIVERSITY
BI034/SI034 INFORMATION TECHNOLOGY STUDIES 3
LAB EXERCISE 6: For Loop

Write C++ codes using For Loops to provide output for the tasks given below :-

1. Write a program to print numbers from 1 to 200 and reverse.

2. Write a program to print numbers from 1 to 10 and then sum the numbers.

3. Write a program to check whether an integer entered by the user is a prime number or not. You
can use for loop and if..else statement in your code.

4. Write a program in C++ to display the pattern like right angle triangle using an asterisk (*). The
number of rows in the triangle will be determined by the number input by the users. Output as
follows:-

5. Write a program in C++ to display the pattern like right angle triangle with right justified using
digits.
The number of rows in the triangle will be determined by the number input by the users. Output
as follows:-

You might also like