C++ 2-D Arrays | Set-2
Submissions: 10752   Accuracy:

31.5%

  Difficulty: Basic   Marks: 1

Given n*n spaced integers of a 2-d Array.Task is to set every value in the matrix to 0 if that row or columns contains a 0.

Input:
First line of input file contains an integer T, denoting the number of test cases. Then T test case follow. First line of each test case contains a integer n.Next line contains n*n spaced integers. 

Output:
For each test case, Print the final matrix formed after performing the required task.

Constraints:
1<=T<=110
1<=n<=100
0<=a[i][j]<=1000

Example:
Input:
1
3
1 2 3 4 0 5 0 6 7
Output:
0 0 3 0 0 0 0 0 0 

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: S_A
Author: saksham0751


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.