Sum of odd numbers in matrix rows
PHP
Medium
loops
Task «Sum of odd numbers in matrix rows»
Given a square matrix of size N x N. It is required to calculate the sum of odd elements in each row of the matrix. If there are no odd numbers in a row, output 0. Use nested loops to process the matrix.
Input Format
The first line contains an integer N (1 ≤ N ≤ 100). The next N lines each contain N integers separated by spaces, each integer from -1000 to 1000.
Output Format
Output N lines, each containing a single integer — the sum of odd elements in the corresponding row.
Examples
Example 1
INPUT
5
1 -2 3 4 -5
OUTPUT
-1
Example 2
INPUT
test test test
test
pass
OUTPUT
pass pass pass
main.php