Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n, m, value = 1;
- cin >> n >> m;
- for (int i = 1; i <= n; i++) {
- //1
- for (int r = 1; r <= m; r++) {
- cout << ((i % 2 == 1) ? " *" : " -");
- }
- //2
- for (int r = 1; r <= m; r++) {
- if(i % 2 == 1)
- cout << " *";
- else
- cout << " -";
- }
- //3
- if (i % 2 == 1) {
- for (int r = 1; r <= m; r++) {
- cout << " *";
- }
- }
- else {
- for (int r = 1; r <= m; r++) {
- cout << " -";
- }
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement