Skip to content
This repository has been archived by the owner on Nov 10, 2021. It is now read-only.

Create Diamond_Pattern_C++ #538

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Patterns/Diamond_Pattern_C++
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* In this programme the user have to enter the number of rows for the diamond dimenson to print the dimond patter as he wishes*/

#include<iostream>
using namespace std;
int main()
{
int n, x, i, j;
cout << "Enter number of rows: "; //user have to enter the number of rows here
cin >> n;
for(i = 0; i <= n; i++)
{
for(x = n; x > i; x--)
cout << " ";
for(j=0; j<i; j++)
cout << "* ";
cout << "\n";
}
for(i = 1; i < n; i++)
{
for(x = 0; x < i; x++)
cout << " ";
for(j = n; j > i; j--)
cout << "* ";
// After each row ending the line
cout << "\n";
}
return 0;
}