-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern11.cpp
More file actions
28 lines (28 loc) · 866 Bytes
/
pattern11.cpp
File metadata and controls
28 lines (28 loc) · 866 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
#include <iostream>
using namespace std;
int main(){
int n,i,j; // *****
cin>>n; // * *
for(i=1;i<=n;i++){ // * *
for(j=i;j<n;j++){ // * *
cout<<" "; //*****
} // Star pattern
if((i==1)||(i==n)){ // 'i' is for rows
for(j=1;j<=n;j++){ // 'j' is for columns
cout<<"*";
}
}
else{
for(j=1;j<=n;j++){
if((j==1)||(j==n)){
cout<<"*";
}
else{
cout<<" ";
}
}
}
cout<<endl;
}
return 0;
}