Write a python program to make two diagonal elements into 0
Answers
Answered by
0
Answer:
Input: mat[][] =
{{ 2, 1, 7 },
{ 3, 7, 2 },
{ 5, 4, 9 }}
Output:
{ {0, 1, 0},
{3, 0, 2},
{0, 4, 0}}
Input: mat[][] =
{{1, 3, 5, 6, 7},
{3, 5, 3, 2, 1},
{1, 2, 3, 4, 5},
{7, 9, 2, 1, 6},
{9, 1, 5, 3, 2}}
Output:
{{0, 3, 5, 6, 0},
{3, 0, 3, 0, 1},
{1, 2, 0, 4, 5},
{7, 0, 2, 0, 6},
{0, 1, 5, 3, 0}}
Explanation:
Similar questions