Write a program that creates a 4*4 matrix having 2s in the second and fourth row, 1s in other rows and print the matrix

+1 vote
asked Oct 22, 2018 by Hoha
Program ++C

1 Answer

+1 vote
answered Jan 3 by anonymous
#include<iostream>

using namespace std;

int main() {

   int a[4][4] = {{1,1,1,1},{2,2,2,2},{1,1,1,1},{2,2,2,2}};

   for (int row(0); row < 4; row ++) {

       for (int col(0); col < 4; col++) {

            cout << a[row][col]  << ' ';}

      cout << endl;

   }

}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...