- 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 ‘N’ alphabet using the number pattern from 1 to n in C++
In this tutorial, we will be discussing a program to print ‘N’ alphabet using the number pattern from 1 to n.
For this we will have to print the english alphabet N. Our task is to determine the size of the letter and print it back using the numbers from 1 to n.
Example
#include <iostream> using namespace std; //printing the letter N void print_N(int N){ int index, side_index, size; int Right = 1, Left = 1, Diagonal = 2; for (index = 0; index < N; index++) { cout << Left++; for (side_index = 0; side_index < 2 * (index); side_index++) cout << " "; if (index != 0 && index != N - 1) cout << Diagonal++; else cout << " "; for (side_index = 0; side_index < 2 * (N - index - 1); side_index++) cout << " "; cout << Right++; cout << endl; } } int main(int argc, char** argv){ int Size = 8; print_N(Size); return 0; }
Output
1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8
- Related Articles
- C Program to print numbers from 1 to N without using semicolon
- Python program to print check board pattern of n*n using numpy
- Python program to print a checkboard pattern of n*n using numpy.
- Python Program to Read a Number n And Print the Series "1+2+…..+n= "
- Goland Program to Read a Number (n) And Print the Series "1+2+…..+n= "
- Program to print number pattern in C
- Python Program to Read a Number n and Print the Natural Numbers Summation Pattern
- Golang Program to Read a Number (n) and Print the Natural Numbers Summation Pattern
- Print n x n spiral matrix using O(1) extra space in C Program.
- PHP program to print the number pattern
- Program to print last N lines in c++
- Program to find duplicate element from n+1 numbers ranging from 1 to n in Python
- Print prime numbers from 1 to N in reverse order
- Count total number of digits from 1 to N in C++
- Program to print Interesting pattern in C++

Advertisements