diff --git a/HarshKesarwani/pattern6.cpp b/HarshKesarwani/pattern6.cpp new file mode 100644 index 000000000..b9a2b0d64 --- /dev/null +++ b/HarshKesarwani/pattern6.cpp @@ -0,0 +1,28 @@ +#include +using namespace std; + +int main() +{ + cout << endl; + for (int x = 1; x <= 5; x++) + { + for (int y = 1; y <= x; y++) + { + cout << y; + } + for (int y = 1; y <= 9 - x * 2; y++) + { + cout << " "; + } + for (int y = x; y >= 1; y--) + { + if (y != 5) + { + cout << y; + } + } + cout << endl; + } + cout << endl; + return 0; +} diff --git a/HarshKesarwani/pattern7.cpp b/HarshKesarwani/pattern7.cpp new file mode 100644 index 000000000..2d70c5118 --- /dev/null +++ b/HarshKesarwani/pattern7.cpp @@ -0,0 +1,24 @@ +#include +using namespace std; + +int main() +{ + cout << endl; + for (int x = 1; x <= 5; x++) + { + for (int y = 1; y <= 5; y++) + { + if (y == 1 || y == 5 || x == y) + { + cout << "*"; + } + else + { + cout << " "; + } + } + cout << endl; + } + cout << endl; + return 0; +}