- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 Articles
- Program to print pyramid pattern in C
- C Program to print hollow pyramid and diamond pattern
- Program to print hollow pyramid and diamond pattern in C++
- Java Program to Print Pyramid Star Pattern
- Swift program to Print Pyramid Star Pattern
- Swift Program to Print Numeric Pyramid Pattern
- Golang Program to Print Pyramid Star Pattern
- Program to print Inverse Diamond pattern on C++
- Print Pyramid Star Pattern in Java Program
- PHP program to print a pattern of pyramid
- Swift program to Print Reverse Pyramid Star Pattern
- Swift Program to Print Reverse Numeric Pyramid Pattern
- Golang Program to Print Reverse Pyramid Star Pattern
- Swift Program to Print Reverse Pyramid Alphabetic Pattern
- PHP program to print continuous character pattern triangle

Advertisements