Skip to content

Commit

Permalink
pattern questions (#269)
Browse files Browse the repository at this point in the history
* Create Hello World.txt

Code for printing hello world

* print Z.cpp

* pattern
  • Loading branch information
Shubhipandey21 authored Nov 14, 2022
1 parent d76f31d commit a9ef7f7
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <iostream>
using namespace std;

int main(int argc, char **argv){
int n;
cin >> n;
for(int i = 1; i <= n; ++i)
{
for(int j = 1; j <= i; ++j)
{
cout << "* ";
cout<<"\t";
}
cout << "\n";
}
//write your code here

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <iostream>
using namespace std;

int main(int argc, char **argv){
int n;
cin >> n;
for(int i = n; i >= 1; --i)
{
for(int j = 1; j <= i; ++j)
{
cout << "*\t";
}
cout << endl;
    }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <iostream>
using namespace std;

void pypart2(int n)
{
int i = 0, j = 0, k = 0;
while (i < n) {


while (k < (n - i - 1)) {
cout << " \t";
k++;
}


k = 0;
while (j <= i) {
cout << "*\t ";
j++;
}


j = 0;
i++;
cout << endl;
}
}


int main()
{
int n = 5;


pypart2(n);
    return 0;
}

0 comments on commit a9ef7f7

Please sign in to comment.