Computer Science, asked by drishtipandey05, 23 days ago

Write a program to enter 9 numbers into a 2-D array and print the matrix displaying only the even numbers of the array.

Answers

Answered by slpvm9090
0

Answer:

Two dimensional (2D) arrays in C programming with example

BY CHAITANYA SINGH | FILED UNDER: C-PROGRAMMING

An array of arrays is known as 2D array. The two dimensional (2D) array in C programming is also known as matrix. A matrix can be represented as a table of rows and columns. Before we discuss more about two Dimensional array lets have a look at the following C program.

Simple Two dimensional(2D) Array Example

For now don’t worry how to initialize a two dimensional array, we will discuss that part later. This program demonstrates how to store the elements entered by user in a 2d array and how to display the elements of a two dimensional array.

Explanation:

please mark me as brain list

Answered by AahanaAndAkshata
1

Explanation:

import java.util.*;

public class EvenMatrix

{

public static void main()

{

Scanner sc = new Scanner(System.in);

int n = 3;

int m = n;

int a[][] = new int[n][m];

for(int i = 0; i < n; i++)

{

System.out.println("Enter the values for row " + (i + 1));

for(int j = 0; j < m; j++)

{

a[i][j] = sc.nextInt();

}

}

for (int i = 0; i < a.length; i++)

           for (int j = 0; j < a[i].length; j++)

           if(a[i][j]%2==0)

           {

               System.out.print(a[i][j] + " ");

           }

       }

   }

Similar questions