forked from pratyushmp/code_opensource_2020
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatternBased.cpp
More file actions
67 lines (63 loc) · 852 Bytes
/
Copy pathPatternBased.cpp
File metadata and controls
67 lines (63 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <iostream>
using namespace std;
int main() {
// your code goes here
int ch,i,j,k=1;
char choice;
// clrscr();
do
{
cout<<"Press 1:Pattern 1\n";
cout<<"Press 2:Pattern 2\n";
cout<<"Press 3:Pattern 3\n";
cout<<"Press 4:Pattern 4\n";
cin>>ch;
switch(ch)
{
case 1:
for(i=1;i<5;i++)
{
for(j=1;j<=i;j++)
{
cout<<i;
}
cout<<endl;
}
break;
case 2:
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
cout<<j;
}
cout<<endl;
}
break;
case 3:
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
cout<<k++;
}
cout<<endl;
}
break;
case 4:
k=1;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
cout<<k++;
}
cout<<endl;
}
break;
}
cout<<"Do you want to Continue(Y?N)?";
cin>>choice;
}while(choice=='Y'||choice=='y');
return 0;
}