0% found this document useful (0 votes)
10 views8 pages

Looping Sheet

The document contains a series of programming tasks in C++ focused on generating various patterns using asterisks, numbers, and letters. Each task includes a description of the desired output format, such as right angle triangles, pyramids, and diamonds. The document serves as a guide for practicing C++ programming and understanding loops and pattern generation.

Uploaded by

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

Looping Sheet

The document contains a series of programming tasks in C++ focused on generating various patterns using asterisks, numbers, and letters. Each task includes a description of the desired output format, such as right angle triangles, pyramids, and diamonds. The document serves as a guide for practicing C++ programming and understanding loops and pattern generation.

Uploaded by

THE MAZE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Looping Sheet

1- Write a program in C++ to display a pattern like a right angle triangle


using an asterisk.

Sample Output:

Input number of rows: 5

*
**
***
****
*****

2. Write a program in C++ to display the pattern like right angle triangle with
number.

Sample Output:
Input number of rows: 5

1
12
123
1234
12345

3. Write a C++ program that makes a pattern such as a right angle triangle
using numbers that repeat.
Sample Output:
Input number of rows: 5
1
22
333
4444
55555

4. Write a C++ program to make such a pattern like a right angle triangle
with the number increased by 1.

Sample Output:
Input number of rows: 4

1
2 3
4 5 6
7 8 9 10

5. Write a C++ program to make such a pattern like a pyramid with


numbers increased by 1.

Sample Output:
Input number of rows: 4

1
2 3
4 5 6
7 8 9 10

6. Write a C++ program to make such a pattern like a pyramid with an


asterisk.
Sample Output:
Input number of rows: 5

*
* *
* * *
* * * *
* * * * *

7. Write a C++ program to make such a pattern, like a pyramid, with a


repeating number.

Sample Output:
Input number of rows: 5

1
2 2
3 3 3
4 4 4 4
5 5 5 5 5

8. Write a C++ program that displays the pattern like a pyramid using
asterisks, with odd numbers in each row.

Sample Output:
Input number of rows: 5

*
***
*****
*******
9. Write a C++ program to print Floyd's Triangle.

Sample Output:
Input number of rows: 5

1
01
101
0101
10101

10. Write a C++ program to display a pattern like a diamond.


Sample Output:
Input number of rows (half of the diamond): 5

*
***
*****
*******
*********
*******
*****
***
*

11. Write a C++ program to display Pascal's triangle like a pyramid.


Sample Output:
Input number of rows: 5

1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
12. Write a C++ program to display Pascal's triangle like a right angle
triangle.
Sample Output:
Input number of rows: 7
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1

13. Write a program in C++ to display such a pattern for n number of rows
using numbers. Odd numbers will appear in each row. The first and last
number of each row will be 1 and the middle column will be the row
number.
Sample Output:

Input number of rows: 5

1
121
12321
1234321
123454321

14. Write a program in C++ to display the pyramid pattern using the
alphabet.
Sample Output:
Input the number of Letters (less than 26) in the
Pyramid: 5
A
A B A
A B C B A
A B C D C B A
A B C D E D C B A
15. Write a C++ program to print a pyramid of digits as shown below for n
number of lines.
1
232
34543
4567654
567898765

Sample Output:

Input the number of rows: 5

1
232
34543
4567654
567898765

16. Write a C++ program to print a pattern in which the highest number of
columns appears in the first row.

Sample Output:
Input the number of rows: 5

12345
2345
345
45
5

17. Write a C++ program that displays the pattern with the highest columns
in the first row and digits with the right justified digits.
Sample Output:
Input number of rows: 5

12345
1234
123
12
1

18. Write a C++ program to display the pattern using digits with left justified
spacing and the highest columns appearing in the first row in descending
order.

Sample Output:
Input number of rows: 5

5 4 3 2 1
4 3 2 1
3 2 1
2 1
1

19. Write a C++ program to display the pattern like right angle triangle with
right justified digits.

Sample Output:
Input number of rows: 5

1
21
321
4321
54321
20. Write a program in C++ to display the pattern like pyramid, power of 2.
Sample Output:

Input the number of rows: 5


1
1 2 1
1 2 4 2 1
1 2 4 8 4 2 1
1 2 4 8 16 8 4 2 1

21. Write a program in C++ to display such a pattern for n number of rows
using numbers. There will be odd numbers in each row. The first and last
number of each row will be 1 and the middle column will be the row
number. N numbers of columns will appear in the 1st row.

Sample Output:
Input number of rows: 7

1234567654321
12345654321
123454321
1234321
12321
121
1

You might also like