Make following patterns using loops. Do not hard code anything.
i)
|......|....................|
|......|.......***....*.....|
|......|......**....*.*.*...|
|......|.....**.....*...*...|
|......|......**............|
|......|........***.........|
|......|....................|
ii)
1
232
34543
4567654
567898765
4567654
34543
232
1
2 1234567654321
12345654321
123454321
1234321
12321
121
1
iii)
1 *
**
****
***********
*** ***
** **
* *
2
-.*
-.*-.*
-.*-.*-.*
-.*-.*-.*-.*
-.*-.*-.*-.*-.*
SOLUTIO CODE
#include<iostream>
using namespace std;
int main() {
for(int i = 0; i< 5; i++)
{
for(int j = 0; j<(i+1); j++)
{
cout<<"-.*";
}
cout<<endl;
}
  return 0;
}
SAMPLE OUTPUT
Comments
Leave a comment