-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangle pattern.cpp
More file actions
54 lines (42 loc) · 835 Bytes
/
Rectangle pattern.cpp
File metadata and controls
54 lines (42 loc) · 835 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
/*
Print rectangle pattern. See example for more details.
Input Format
First and only line of input contains a single integer N - the size of the rectangle.
Constraints
1 <= N <= 50
Output Format
For the given integer, print rectangle pattern as shown in example.
Sample Input 0
5
Sample Output 0
5432*
543*1
54*21
5*321
*4321
Explanation 0
Self Explanatory
*/
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int N;
cin>>N;
for(int i=1;i<=N;i++){
for(int j=N;j>=1;j--){
if(i==j){
cout<<"*";
}
else{
cout<<j;
}
}
cout<<endl;
}
return 0;
}