

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Program to print an inverse pyramid character pattern in C++
In this tutorial, we will be discussing a program to print an inverse pyramid character pattern.
For this we will be provided with the number of rows containing in the inverted pyramid triangle. Our task is to print the alphabets in the given number of rows to develop the shape of an inverse pyramid.
Example
#include <bits/stdc++.h> using namespace std; //printing the inverse pyramid pattern void inv_pyramid(int n){ int i, j, num, gap; for (i = n; i >= 1; i--) { for (gap = n - 1; gap >= i; gap--) { cout<<" "; cout<<" "; } num = 'A'; for (j = 1; j <= i; j++) { cout << (char) num++ <<" "; } for (j = i - 1; j >= 0; j--) { cout << (char) --num <<" "; } cout<<"\n"; } } int main(){ int n = 5; inv_pyramid(n); return 0; }
Output
A B C D E E D C B A A B C D D C B A A B C C B A A B B A A A
- Related Questions & Answers
- Program to print pyramid pattern in C
- Java Program to Print Pyramid Star Pattern
- Print Pyramid Star Pattern in Java Program
- PHP program to print a pattern of pyramid
- C Program to print hollow pyramid and diamond pattern
- Program to print Inverse Diamond pattern on C++
- Program to print hollow pyramid and diamond pattern in C++
- PHP program to print continuous character pattern triangle
- Java Program to Create Pyramid and Pattern
- Python Program to Print an Inverted Star Pattern
- Golang Program to Print an Inverted Star Pattern
- C++ Programs To Create Pyramid and Pattern
- Program to print Interesting pattern in C++
- Program to print Kite Pattern in C++
- Program to print number pattern in C
Advertisements