-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern23.cpp
More file actions
33 lines (31 loc) · 740 Bytes
/
pattern23.cpp
File metadata and controls
33 lines (31 loc) · 740 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
#include<bits/stdc++.h>
using namespace std;
int drawpattern(int *n)
{ int k=4;
for(int i=0;i<*n;i++)
{ int k=*n-i;
for(int j=0;j<*n*2;j++)
{
if(j<=*n-1){
if(j<k)
cout<<j+1;
else
cout<<"*";
}
else{
if(j<=((*n*2)-1-k))
cout<<"*";
else
cout<<abs(*n*2-j);
}}
cout<<endl;
}
return 0;
}
int main(){
int n;
cout<<"Enter the value of n"<<endl;
cin>>n;
drawpattern(&n);
return 0;
}