Write a program that produces the following output using nes

Write a program that produces the following output using nested for loops :

+------+

| ^^ |

| ^ ^ |

|^ ^|

| ^^ |

| ^ ^ |

|^ ^|

+------+

| vv |

| v v |

|v v|

| vv |

| v v |

|v v|

+------+

https://gyazo.com/1736f97159105d4d6ee145ef8dedc262

Solution

#include<iostream>

int main()
{
   int i,j,first=0;
   for (i = 0; i < 2; i++)
   {
       printf(\"+------+\ \");
       for (j = 0; j < 6; j++)
       {
           if (!first)
               printf(\"| ^^ |\ \");
           else
               printf(\"| vv |\ \");
          
       }
       first = 1;
   }
   printf(\"+------+\ \");
}

-----------------------------------------------------------------------

//output

+------+
| ^^ |
| ^^ |
| ^^ |
| ^^ |
| ^^ |
| ^^ |
+------+
| vv |
| vv |
| vv |
| vv |
| vv |
| vv |
+------+

Write a program that produces the following output using nested for loops : +------+ | ^^ | | ^ ^ | |^ ^| | ^^ | | ^ ^ | |^ ^| +------+ | vv | | v v | |v v| | v
Write a program that produces the following output using nested for loops : +------+ | ^^ | | ^ ^ | |^ ^| | ^^ | | ^ ^ | |^ ^| +------+ | vv | | v v | |v v| | v

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site