Write a complete C program that does the following Every fou


Write a complete C++ program that does the following. Every fourth row and column are made of Ys and the others are made of Ns. N N N Y N N N N N N Y N N N N N N Y N N N Y Y Y Y Y Y Y N N N Y N N N N N N Y N N N N N N Y N N N Using for loop write a complete C++ program that does the following. 4 6 8 10 12 Using lor loop write a complete C++ program that does the following. 2 33 444 555

Solution

1.

#include <iostream>
using namespace std;

int main()
{
   int i,j;
   for(i=1;i<=7;i++)
   {
   for(j=1;j<=7;j++)
   {
      if( i == 4 || j == 4) //if row is 4 or column is 4 print Y else print N
      cout<<\"Y\";
      else
      cout<<\"N\";
   }
   cout<<endl;
   }
   return 0;
}

Output:

Success time: 0 memory: 3468 signal:0

2.

#include <iostream>
using namespace std;

int main()
{
   int i;
   for(i=4;i<=12;i=i+2) //loop to print i and increment its value with 2 until =12
   {
      cout<<i<<\"\\t\";
     
   }
   return 0;
}

output:

Success time: 0 memory: 3468 signal:0

3

#include <iostream>
using namespace std;

int main()
{
   int i,j;
   for(i=2;i<=5;i++)   
   {
      for(j=1;j<i;j++) //compare i and j and increment the times of i with j
      {
          cout<<i;
      }
      cout<<endl;
   }
   return 0;
}

output:

Success time: 0 memory: 3468 signal:0

 Write a complete C++ program that does the following. Every fourth row and column are made of Ys and the others are made of Ns. N N N Y N N N N N N Y N N N N N

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site