0% found this document useful (0 votes)
3 views4 pages

Programming_Nested_Loop_Questions

The document provides a series of programming exercises focused on creating various shapes using nested loops. It includes tasks for printing triangles, pyramids, diamonds, and other patterns using stars and numbers. Each exercise is designed to enhance understanding of nested loops in programming.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
3 views4 pages

Programming_Nested_Loop_Questions

The document provides a series of programming exercises focused on creating various shapes using nested loops. It includes tasks for printing triangles, pyramids, diamonds, and other patterns using stars and numbers. Each exercise is designed to enhance understanding of nested loops in programming.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 4

Programming Nested Loop Questions on Shapes

1. Write a program to print a right-angled triangle using stars (*).

**

***

****

2. Write a program to print an inverted right-angled triangle using stars (*).

****

***

**

3. Write a program to print a pyramid using stars (*).

***

*****

*******

4. Write a program to print an inverted pyramid using stars (*).

*******

*****

***

5. Write a program to print a diamond shape using stars (*).

***

*****

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

***

6. Write a program to print a half pyramid using numbers.

12

123

1234

7. Write a program to print an inverted half pyramid using numbers.

1234

123

12

8. Write a program to print a full pyramid of numbers.

121

12321

1234321

9. Write a program to print an inverted number pyramid.

1234321

12321

121

10. Write a program to print a hollow square using stars (*).

*****

* *

* *
* *

*****

11. Write a program to print a square with a cross inside using stars (*).

* *

**

**

* *

12. Write a program to print a right-aligned half pyramid using stars (*).

**

***

****

13. Write a program to print an hourglass pattern using stars (*).

*******

*****

***

***

*****

*******

14. Write a program to print a hollow diamond using stars (*).

**

* *

*******

* *
**

15. Write a program to print an X using stars (*).

* *

**

**

* *

You might also like