3 solutions
-
1
#include using namespace std;
int main() { char a; cin >> a; int b = 4; int c = 4; for (int i = 1; i <= 3; i++) { for (int x = 1; x <= 5; x++) { if (i + x >= b && i + x <= c) { cout << a; } else { cout << " "; } } cout << endl; c = c + 2; } int e = 8; int f = 6; for (int n = 4; n <= 5; n++) { for (int y = 1; y <= 5; y++) { if (n + y >= f && n + y <= e) { cout << a; } else { cout << " "; } } cout << endl; f = f + 2; } return 0; }
-
-3
#include<iostream> using namespace std; int main(){ char a; cin>>a; int b = 4; int c = 4; for(int i = 1;i<=3;i++){ for(int x = 1;x<=5;x++){ if(i+x>=b&&i+x<=c){ cout<<a; }else{ cout<<" "; } } cout<<endl; c = c+2; } int e = 8; int f = 6; for(int n = 4;n<=5;n++){ for(int y = 1;y<=5;y++){ if(n + y >= f && n+y <= e){ cout<<a; }else{ cout<<" "; } } cout<<endl; f = f+2; } return 0; }
- 1
Information
- ID
- 493
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 3
- Tags
- # Submissions
- 193
- Accepted
- 98
- Uploaded By