Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern 7 in C++ #365

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
47 changes: 47 additions & 0 deletions Pattern/Pattern7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## Description
In this code you will find how you can make * pattern by using For loop

## Code
```cpp

#include<iostream>
using namespace std;
int main()
{
int n, s, i, j;
cout << "Enter number of rows: ";
cin >> n;
for(i = 0; i <= n; i++)
{
for(s = n; s > i; s--)
cout << " ";
for(j=0; j<i; j++)
cout << "* ";
cout << "\n";
}
for(i = 1; i < n; i++)
{
for(s = 0; s < i; s++)
cout << " ";
for(j = n; j > i; j--)
cout << "* ";
// ending line after each row
cout << "\n";
}
return 0;
}
```
## Input
```
N = 4
```
## Output
```
*
* *
* * *
* * * *
* * *
*

```
48 changes: 48 additions & 0 deletions Pattern/Pattern8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## Description
In this code you will find how you can make * pattern by using For loop

## Code
```cpp

#include<iostream>
using namespace std;
int main()
{
int n, i , j;
cout << "Enter number of rows: ";
cin >> n;
for(i = 1; i <= n; i++)
{
for(j = 1; j <= i; j++)
{
cout << "*";
}
cout<<"\n";
}
for(i = n; i >= 1; i--)
{
for(j = 1; j <= i; j++)
{
cout << "*" ;
}
// ending line after each row
cout<<"\n";
}
return 0;
}
```
## Input
```
N = 4
```
## Output
```
*
**
***
****
****
***
**
*
```