Programs to print Interesting Patterns
Last Updated :
02 May, 2025
Program to print the following pattern:
Examples :
Input : 5
Output:
* * * * * * * * * *
* * * * * * * *
* * * * * *
* * * *
* *
* *
* * * *
* * * * * *
* * * * * * * *
* * * * * * * * * *
This program is divided into four parts.
C++
// C++ program to print
// the given pattern
#include<iostream>
using namespace std;
void pattern(int n)
{
int i, j;
// This is upper half of pattern
for(i = 1; i <= n; i++)
{
for(j = 1; j <= (2 * n); j++)
{
// Left part of pattern
if (i > (n - j + 1))
cout << " ";
else
cout << "*";
// Right part of pattern
if ((i + n) > j)
cout << " ";
else
cout << "*";
}
cout << endl ;
}
// This is lower half of pattern
for(i = 1; i <= n; i++)
{
for(j = 1; j <= (2 * n); j++)
{
// Right Part of pattern
if (i < j)
cout << " ";
else
cout << "*";
// Left Part of pattern
if (i <= ((2 * n) - j))
cout << " ";
else
cout << "*";
}
cout << endl;
}
}
// Driver Code
int main()
{
pattern(7);
return 0;
}
// This code is contributed by bunnyram19
C
// C program to print
// the given pattern
#include<stdio.h>
void pattern(int n)
{
int i,j;
// This is upper half of pattern
for (i=1; i<=n; i++)
{
for (j=1; j<=(2*n); j++)
{
// Left part of pattern
if (i>(n-j+1))
printf(" ");
else
printf("*");
// Right part of pattern
if ((i+n)>j)
printf(" ");
else
printf("*");
}
printf("\n");
}
// This is lower half of pattern
for (i=1; i<=n; i++)
{
for (j=1; j<=(2*n); j++)
{
// Right Part of pattern
if (i<j)
printf(" ");
else
printf("*");
// Left Part of pattern
if (i<=((2*n)-j))
printf(" ");
else
printf("*");
}
printf("\n");
}
}
// Driver Code
int main()
{
pattern(7);
return 0;
}
Java
// Java program to print
// the given pattern
import java.io.*;
class GFG {
static void pattern(int n)
{
int i, j;
// This is upper half of pattern
for (i = 1; i <= n; i++) {
for (j = 1; j <= (2 * n); j++) {
// Left part of pattern
if (i > (n - j + 1))
System.out.print(" ");
else
System.out.print("*");
// Right part of pattern
if ((i + n) > j)
System.out.print(" ");
else
System.out.print("*");
}
System.out.println("");
}
// This is lower half of pattern
for (i = 1; i <= n; i++) {
for (j = 1; j <= (2 * n); j++) {
// Right Part of pattern
if (i < j)
System.out.print(" ");
else
System.out.print("*");
// Left Part of pattern
if (i <= ((2 * n) - j))
System.out.print(" ");
else
System.out.print("*");
}
System.out.println("");
}
}
// Driver Code
public static void main(String[] args)
{
pattern(7);
}
}
// This code is contributed by vt_m
Python
# Python3 program to print
# the given pattern
def pattern(n):
# This is upper half of pattern
for i in range (1, n + 1):
for j in range (1, 2 * n):
# Left part of pattern
if i > (n - j + 1):
print("", end = ' ');
else:
print("*", end = '');
# Right part of pattern
if i + n - 1 > j:
print("", end = ' ');
else:
print("*", end = '');
print("");
# This is lower half of pattern
for i in range (1, n + 1):
for j in range (1, 2 * n):
#Left part of pattern
if i < j:
print("", end = ' ');
else:
print("*", end = '');
# Right part of pattern
if i < 2 * n - j:
print("", end = ' ');
else:
print("*", end = '');
print("");
# Driver Code
pattern(7);
# This code is contributed by mits
C#
// C# program to print
// the given pattern
using System;
class GFG
{
static void pattern(int n)
{
int i, j;
// This is upper
// half of pattern
for (i = 1; i <= n; i++)
{
for (j = 1; j <= (2 * n); j++)
{
// Left part of pattern
if (i > (n - j + 1))
Console.Write(" ");
else
Console.Write("*");
// Right part of pattern
if ((i + n) > j)
Console.Write(" ");
else
Console.Write("*");
}
Console.WriteLine("");
}
// This is lower
// half of pattern
for (i = 1; i <= n; i++)
{
for (j = 1; j <= (2 * n); j++)
{
// Right Part of pattern
if (i < j)
Console.Write(" ");
else
Console.Write("*");
// Left Part of pattern
if (i <= ((2 * n) - j))
Console.Write(" ");
else
Console.Write("*");
}
Console.WriteLine("");
}
}
// Driver Code
static public void Main ()
{
pattern(7);
}
}
// This code is contributed by ajit
JavaScript
<script>
// JavaScript program to print
// the given pattern
function pattern(n) {
var i, j;
// This is upper half of pattern
for (i = 1; i <= n; i++) {
for (j = 1; j <= 2 * n; j++) {
// Left part of pattern
if (i > n - j + 1)
document.write(" ");
else
document.write("*");
// Right part of pattern
if (i + n > j)
document.write(" ");
else
document.write("*");
}
document.write("<br>");
}
// This is lower half of pattern
for (i = 1; i <= n; i++) {
for (j = 1; j <= 2 * n; j++) {
// Right Part of pattern
if (i < j)
document.write(" ");
else
document.write("*");
// Left Part of pattern
if (i <= 2 * n - j)
document.write(" ");
else
document.write("*");
}
document.write("<br>");
}
}
// Driver Code
pattern(7);
</script>
PHP
<?php
// PHP program to print
// the given pattern
function pattern($n)
{
$i; $j;
// This is upper half of pattern
for ($i = 1; $i <= $n; $i++)
{
for ($j = 1; $j <= (2 * $n); $j++)
{
// Left part of pattern
if ($i > ($n - $j + 1))
echo " ";
else
echo "*";
// Right part of pattern
if (($i + $n) > $j)
echo " ";
else
echo "*";
}
printf("\n");
}
// This is lower half of pattern
for ($i = 1; $i <= $n; $i++)
{
for ($j = 1; $j <= (2 * $n); $j++)
{
// Right Part of pattern
if ($i < $j)
echo " ";
else
echo "*";
// Left Part of pattern
if ($i <= ((2 * $n) - $j))
echo " ";
else
echo "*";
}
echo "\n";
}
}
// Driver Code
pattern(7);
// This code is contributed by m_kit
?>
Output* * * * * * * * * * * * * *
* * * * * * * * * * * *
* * * * * * * * * *
* * * * * * * *
* * * * * *
* * * *
* *
* *
* * * *
* * * * * *
* * * * * * * *
* * * * * * * * * *
* * * * * * * * * * * *
* * * * * * * * * * * * * *
Time Complexity: O(n2)
Auxiliary Space: O(1)
Program to print following pattern:
Examples :
Input : 5
Output:
* *
* * * *
* * * * * *
* * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * *
* * * * * *
* * * *
* *
This program is divided into four parts.
C++
// C++ program to print the
// given pattern
#include <bits/stdc++.h>
using namespace std;
void pattern(int n)
{
int i, j;
// This is upper half of pattern
for (i = 1; i <= n; i++)
{
for (j = 1; j <= (2 * n); j++)
{
// Left part of pattern
if (i < j)
cout << " ";
else
cout << "*";
// Right part of pattern
if (i <= ((2 * n) - j))
cout << " ";
else
cout << "*";
}
cout << "\n";
}
// This is lower half of pattern
for (i = 1; i <= n; i++)
{
for (j = 1; j <= (2 * n); j++)
{
// Left part of pattern
if (i > (n - j + 1))
cout <<" ";
else
cout <<"*";
// Right part of pattern
if ((i + n) > j)
cout << " ";
else
cout << "*";
}
cout << "\n";
}
}
// Driver Code
int main()
{
pattern(7);
return 0;
}
// This code is contributed by shivanisinghss2110
C
// C program to print the
// given pattern
#include<stdio.h>
void pattern(int n)
{
int i,j;
// This is upper half of pattern
for (i=1; i<=n; i++)
{
for (j=1; j<=(2*n); j++)
{
// Left part of pattern
if (i<j)
printf(" ");
else
printf("*");
// Right part of pattern
if (i<=((2*n)-j))
printf(" ");
else
printf("*");
}
printf("\n");
}
// This is lower half of pattern
for (i=1; i<=n; i++)
{
for (j=1;j<=(2*n);j++)
{
// Left part of pattern
if (i>(n-j+1))
printf(" ");
else
printf("*");
// Right part of pattern
if ((i+n)>j)
printf(" ");
else
printf("*");
}
printf("\n");
}
}
// Driver Code
int main()
{
pattern(7);
return 0;
}
Java
// Java program to print the
// given pattern
import java.io.*;
class GFG {
static void pattern(int n)
{
int i, j;
// This is upper half of pattern
for (i = 1; i <= n; i++) {
for (j = 1; j <= (2 * n); j++) {
// Left part of pattern
if (i < j)
System.out.print(" ");
else
System.out.print("*");
// Right part of pattern
if (i <= ((2 * n) - j))
System.out.print(" ");
else
System.out.print("*");
}
System.out.println("");
}
// This is lower half of pattern
for (i = 1; i <= n; i++) {
for (j = 1; j <= (2 * n); j++) {
// Left part of pattern
if (i > (n - j + 1))
System.out.print(" ");
else
System.out.print("*");
// Right part of pattern
if ((i + n) > j)
System.out.print(" ");
else
System.out.print("*");
}
System.out.println("");
}
}
// Driver Code
public static void main(String[] args)
{
pattern(7);
}
}
// This code is contributed by vt_m
Python
# Python3 program to
# print the given pattern
def pattern(n):
# This is upper
# half of pattern
for i in range(1, n + 1):
for j in range(1, 2 * n + 1):
# Left part of pattern
if (i < j):
print("", end = " ");
else:
print("*", end = "");
# Right part of pattern
if (i <= ((2 * n) - j)):
print("", end = " ");
else:
print("*", end = "");
print("");
# This is lower
# half of pattern
for i in range(1, n + 1):
for j in range(1, 2 * n + 1):
# Left part of pattern
if (i > (n - j + 1)):
print("", end = " ");
else:
print("*", end = "");
# Right part of pattern
if ((i + n) > j):
print("", end = " ");
else:
print("*", end = "");
print("");
# Driver Code
pattern(7);
# This code is contributed
# by mits
C#
// C# program to print
// the given pattern
using System;
class GFG
{
static void pattern(int n)
{
int i, j;
// This is upper
// half of pattern
for (i = 1; i <= n; i++)
{
for (j = 1; j <= (2 * n); j++)
{
// Left part of pattern
if (i < j)
Console.Write(" ");
else
Console.Write("*");
// Right part of pattern
if (i <= ((2 * n) - j))
Console.Write(" ");
else
Console.Write("*");
}
Console.WriteLine("");
}
// This is lower
// half of pattern
for (i = 1; i <= n; i++)
{
for (j = 1; j <= (2 * n); j++)
{
// Left part of pattern
if (i > (n - j + 1))
Console.Write(" ");
else
Console.Write("*");
// Right part of pattern
if ((i + n) > j)
Console.Write(" ");
else
Console.Write("*");
}
Console.WriteLine("");
}
}
// Driver Code
static public void Main ()
{
pattern(7);
}
}
// This code is contributed by ajit
JavaScript
<script>
// Javascript program to print the
// given pattern
function pattern(n)
{
var i, j;
// This is upper half of pattern
for(i = 1; i <= n; i++)
{
for(j = 1; j <= (2 * n); j++)
{
// Left part of pattern
if (i < j)
document.write(" ");
else
document.write("*");
// Right part of pattern
if (i <= ((2 * n) - j))
document.write(" ");
else
document.write("*");
}
document.write('<br>');
}
// This is lower half of pattern
for(i = 1; i <= n; i++)
{
for(j = 1; j <= (2 * n); j++)
{
// Left part of pattern
if (i > (n - j + 1))
document.write(" ");
else
document.write("*");
// Right part of pattern
if ((i + n) > j)
document.write(" ");
else
document.write("*");
}
document.write('<br>');
}
}
// Driver Code
pattern(7);
// This code is contributed by Princi Singh
</script>
PHP
<?php
// PHP program to print
// the given pattern
function pattern($n)
{
$i; $j;
// This is upper half
// of pattern
for ($i = 1; $i <= $n; $i++)
{
for ($j = 1; $j <= (2 * $n); $j++)
{
// Left part of pattern
if ($i < $j)
echo " ";
else
echo "*";
// Right part of pattern
if ($i <= ((2 * $n) - $j))
echo " ";
else
echo "*";
}
echo "\n";
}
// This is lower half of pattern
for ($i = 1; $i <= $n; $i++)
{
for ($j = 1;$j <= (2 * $n); $j++)
{
// Left part of pattern
if ($i > ($n - $j + 1))
echo " ";
else
echo "*";
// Right part of pattern
if (($i + $n) > $j)
echo " ";
else
echo "*";
}
echo "\n";
}
}
// Driver Code
pattern(7);
// This code is contributed by aj_36
?>
Output* *
* * * *
* * * * * *
* * * * * * * *
* * * * * * * * * *
* * * * * * * * * * * *
* * * * * * * * * * * * * *
* * * * * * * * * * * * * *
* * * * * * * * * * * *
* * * * * * * * * *
* * * * * * * *
* * * * * *
* * * *
* *
Time Complexity: O(n2)
Auxiliary Space: O(1)
Program to print the following pattern:
Examples:
Input : 9 [For Odd number]
Output:
\*******/
*\*****/*
**\***/**
***\*/***
****/****
***/*\***
**/***\**
*/*****\*
/*******\
Input : 8 [For Even number]
Output :
\******/
*\****/*
**\**/**
***\/***
***/\***
**/**\**
*/****\*
/******\
Code implementation to print the given pattern:
C++
// C++ program to print the given pattern
#include <bits/stdc++.h>
using namespace std;
void pattern(int n)
{
// for traversing of rows
for (int i = 1; i <= n; i++) {
// for traversing of columns
for (int j = 1; j <= n; j++) {
// conditions for left-diagonal and
// right-diagonal
if (i == j || i + j == (n + 1)) {
if (i + j == (n + 1)) {
cout << "/";
}
else {
cout << "\\";
}
}
else
cout << "*";
}
cout << endl;
}
}
// Driver Code
int main()
{
pattern(9);
return 0;
}
// This code is contributed by Nitin Kumar
Java
// Java program to print the given pattern
import java.io.*;
class pattern
{
// Function to print the given pattern
static void pattern(int n)
{
// for traversing of rows
for (int i = 1; i <= n; i++)
{
// for traversing of columns
for (int j = 1; j <= n; j++)
{
// conditions for left-diagonal and
// right-diagonal
if (i == j || i + j == (n + 1)) {
if (i + j == (n + 1)) {
System.out.print("/");
}
else {
System.out.print("\\");
}
}
else
System.out.print("*");
}
System.out.println();
}
}
// Driver Code
public static void main(String[] args)
{
pattern(9);
}
}
// This code is contributed by AJAX
Python
# Python3 program to print the given pattern
def pattern(n):
# For traversing of rows
for i in range(1, n+1):
# For traversing of columns
for j in range(1, n+1):
# Conditions for left-diagonal and right-diagonal
if i == j or i+j == n+1:
if i+j == (n+1):
print('/', end = '')
else:
print('\\', end = '')
else:
print('*', end = '')
print('')
#Driver Code
if __name__ == '__main__':
n = 8
pattern(n)
# This code is contributed by Mahendra Varma
C#
// C# program to print the given pattern
using System;
using System.Collections.Generic;
class GFG
{
static void pattern(int n)
{
// for traversing of rows
for (int i = 1; i <= n; i++)
{
// for traversing of columns
for (int j = 1; j <= n; j++)
{
// conditions for left-diagonal and
// right-diagonal
if (i == j || i + j == (n + 1)) {
if (i + j == (n + 1)) {
Console.Write("/");
}
else {
Console.Write("\\");
}
}
else
Console.Write("*");
}
Console.Write("\n");
}
}
// Driver Code
static void Main(string[] args)
{
pattern(9);
}
}
JavaScript
<script>
// JavaScript program to print the given pattern
// Function to print the given pattern
function pattern(n)
{
// for traversing of rows
for (let i = 1; i <= n; i++)
{
// for traversing of columns
for (let j = 1; j <= n; j++)
{
// conditions for left-diagonal and
// right-diagonal
if (i == j || i + j == (n + 1)) {
if (i + j == (n + 1)) {
document.write("/");
}
else {
document.write("\\");
}
}
else
document.write("*");
}
document.write("<br>");
}
}
pattern(9);
// This code is contributed by lokesh.
</script>
Output\*******/
*\*****/*
**\***/**
***\*/***
****/****
***/*\***
**/***\**
*/*****\*
/*******\
Time Complexity: O(n2)
Auxiliary Space: O(1)
Program to print the following pattern:
Examples :
Input : 8
Output :
7 6 5 4 3 2 1 0
6 5 4 3 2 1 0
5 4 3 2 1 0
4 3 2 1 0
3 2 1 0
2 1 0
1 0
0
Code implementation to print the given pattern:
C++
// C++ program to print the given pattern
#include <bits/stdc++.h>
using namespace std;
void pattern(int n)
{
// for traversing of rows
for (int i = 1; i <= n; i++) {
int k = n - i;
// for traversing of columns
for (int j = 1; j <= n; j++) {
if (j <= (n + 1) - i) {
cout << k << " ";
k--;
}
else {
cout << " ";
}
}
cout << endl;
}
}
// Driver Code
int main()
{
pattern(8);
return 0;
}
// This code is contributed by Nitin Kumar
Java
// Java program to print the given pattern
import java.util.*;
public class Main {
public static void pattern(int n) {
// for traversing of rows
for (int i = 1; i <= n; i++) {
int k = n - i;
// for traversing of columns
for (int j = 1; j <= n; j++) {
if (j <= (n + 1) - i) {
System.out.print(k + " ");
k--;
}
else {
System.out.print(" ");
}
}
System.out.println();
}
}
// Driver Code
public static void main(String args[]) {
pattern(8);
}
}
// this code contributed by SRJ2777
Python
def pattern(n):
# for traversing of rows
for i in range(1, n+1):
# inner loop for decrement in i values
for j in range(n - i, -1, -1):
print(j, end=' ')
print()
#Driver Code
if __name__ == '__main__':
n = 8
pattern(n)
C#
// C# program to print the given pattern
using System;
using System.Collections.Generic;
class GFG
{
static void pattern(int n)
{
// for traversing of rows
for (int i = 1; i <= n; i++) {
int k = n - i;
// for traversing of columns
for (int j = 1; j <= n; j++) {
if (j <= (n + 1) - i) {
Console.Write(k + " ");
k--;
}
else {
Console.Write(" ");
}
}
Console.WriteLine();
}
}
// Driver Code
static void Main(string[] args)
{
pattern(8);
}
}
JavaScript
// JavaScript program to print the given pattern
function pattern(n) {
// for traversing of rows
for (let i = 1; i <= n; i++) {
let k = n - i;
// for traversing of columns
for (let j = 1; j <= n; j++) {
if (j <= n + 1 - i) {
console.log(k + " ");
k--;
}
else {
console.log(" ");
}
}
console.log("<br>");
}
}
// Driver Code
pattern(8);
Output7 6 5 4 3 2 1 0
6 5 4 3 2 1 0
5 4 3 2 1 0
4 3 2 1 0
3 2 1 0
2 1 0
1 0
0
Time Complexity: O(n2)
Auxiliary Space: O(1)
Program to print the following pattern :
Examples:
Input: 7
Output:
1
8 2
14 9 3
19 15 10 4
23 20 16 11 5
26 24 21 17 12 6
28 27 25 22 18 13 7
Code implementation to print the given pattern:
C++
// C++ program to print the given pattern
#include <bits/stdc++.h>
using namespace std;
void pattern(int n)F
{
int p, k = 1;
// for traversing of rows
for (int i = 1; i <= n; i++) {
p = k;
// for traversing of columns
for (int j = 1; j <= i; j++) {
cout << p << " ";
p = p - (n - i + j);
}
cout << endl;
k = k + 1 + (n - i);
}
}
// Driver Code
int main()
{
pattern(7);
return 0;
}
// This code is contributed by Nitin Kumar
Java
public class Pattern {
public static void pattern(int n)
{
int p, k = 1;
// for traversing of rows
for (int i = 1; i <= n; i++) {
p = k;
// for traversing of columns
for (int j = 1; j <= i; j++) {
System.out.print(p + " ");
p = p - (n - i + j);
}
System.out.println();
k = k + 1 + (n - i);
}
}
// Driver Code
public static void main(String[] args)
{
pattern(7);
}
}
Python
# code
def pattern(n):
k=1
# for traversing of rows
for i in range(1, n+1):
p=k
# for traversing of columns
for j in range(1,i+1):
print(p, end=' ')
p=p-(n-i+j)
print()
k=k+1+(n-i)
#Driver Code
if __name__ == '__main__':
n = 7
pattern(n)
C#
using System;
namespace Pattern
{
class Program
{
static void Pattern(int n)
{
int p, k = 1;
// for traversing of rows
for (int i = 1; i <= n; i++)
{
p = k;
// for traversing of columns
for (int j = 1; j <= i; j++)
{
Console.Write(p + " ");
p = p - (n - i + j);
}
Console.WriteLine();
k = k + 1 + (n - i);
}
}
// Driver Code
static void Main(string[] args)
{
Pattern(7);
}
}
}
JavaScript
<script>
// JavaScript program to print the given pattern
function pattern(n) {
let k = 1;
// for traversing of rows
for (let i = 1; i <= n; i++) {
let p = k;
// for traversing of columns
for (let j = 1; j <= i; j++) {
document.write(p + " ");
p = p - (n - i + j);
}
document.write("<br>");
k = k + 1 + (n - i);
}
}
pattern(7);
// This code is contributed by lokesh.
</script>
Output1
8 2
14 9 3
19 15 10 4
23 20 16 11 5
26 24 21 17 12 6
28 27 25 22 18 13 7
Time Complexity: O(n2)
Auxiliary Space: O(1)
Similar Reads
Pattern Programs in C
Printing patterns using C programs has always been an interesting problem domain. We can print different patterns like star patterns, pyramid patterns, Floyd's triangle, Pascal's triangle, etc. in C language. These problems require the knowledge of loops and if-else statements.We will discuss the fo
15+ min read
C Program For Printing Right Half Pyramid Pattern
A half-right pyramid consists of rows with sequential stars, numbers or characters arranged in a triangular shape. The first row has one character, the second row has two, and so on. The characters are aligned to the left making it similar to the right-angle triangle. In this article, we will learn
5 min read
C Program to Print Pyramid Pattern
In C, a pyramid pattern consists of numbers, stars, or alphabets arranged in a triangular shape. In this article, we will learn how to print different shapes of pyramid patterns using C program.Following are the 6 common pyramid patterns:Right Half Pyramid PatternRight half pyramid pattern looks lik
13 min read
C Program to Print Number Pattern
A number pattern involves printing numbers in a specific arrangement or shape, often in the form of a pyramid, triangle, or other geometric shapes. They are great for practicing loops and conditional statements. In this article, we will learn how to print different number patterns in C.Rhombus Numbe
6 min read
C Program to Print Continuous Character Pattern
Here, we will see how to print continuous character patterns using a C program. Below are the examples: Input: rows = 5Output: A B C D E F G H I J K L M N O Input: rows = 3Output: A B C D E F There are 2 ways to print continuous character patterns in C: Using for loop.Using while loop. Let's discuss
5 min read
C Program To Print Character Pyramid Pattern
Pyramid patterns is a classic logical programming exercise where a triangular looking pattern is printed by treating the output screen as a matrix and printing a given character. In this article, we will explore how to print various alphabet pyramid patterns using C program.Half Pyramid PatternHalf
4 min read
C Program to Print Right Half Pyramid Pattern
The Right Half Pyramid Pattern is a triangular pattern consists of rows where each row contains an increasing number of characters. The number of characters starts from 1 and increases by 1 in each subsequent row. Characters are aligned to the left, resembling a right-angle triangle with its hypoten
2 min read
C Program To Print Hollow Pyramid Patterns
The Hollow Pyramid patterns are the variation of pyramid patterns where only the outer edges are filled with characters but the interior is left empty. In this article, we will learn how to print different hollow pyramid patterns.There can be 5 hollow pyramid patterns corresponding to each of the no
12 min read
C Program to Print Cross or X Pattern
The Cross or X Pattern is a pattern where characters or stars are printed diagonally from top-left to bottom-right and from top-right to bottom-left, forming an "X" shape. In this article, we will learn how to print this pattern using a C program. Program to Print Cross or X PatternStar Cross#includ
3 min read
Programs to print Interesting Patterns
Program to print the following pattern: Examples : Input : 5Output:* * * * * * * * * ** * * * * * * ** * * * * ** * * ** ** ** * * ** * * * * ** * * * * * * ** * * * * * * * * *This program is divided into four parts.C++// C++ program to print // the given pattern #include<iostream> using name
15+ min read