Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

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, 2019 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.
...