Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n, m, value = 1;
  7.     cin >> n >> m;
  8.     for (int i = 1; i <= n; i++) {
  9.         //1
  10.         for (int r = 1; r <= m; r++) {
  11.             cout << ((i % 2 == 1) ? " *" : " -");
  12.         }
  13.         //2
  14.         for (int r = 1; r <= m; r++) {
  15.             if(i % 2 == 1)
  16.                 cout << " *";
  17.             else
  18.                 cout << " -";
  19.         }
  20.         //3
  21.         if (i % 2 == 1) {
  22.             for (int r = 1; r <= m; r++) {
  23.                 cout << " *";
  24.             }
  25.         }
  26.         else {
  27.             for (int r = 1; r <= m; r++) {
  28.                 cout << " -";
  29.             }
  30.         }
  31.         cout << endl;
  32.     }
  33.    
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement