0% found this document useful (0 votes)
4 views2 pages

Import Java - Copy

This Java program prompts the user to input the number of rows and columns for a matrix. It then allows the user to enter the elements of the matrix and prints the resulting array. The program utilizes nested loops for both input and output of the matrix elements.

Uploaded by

neelamsahun41
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Import Java - Copy

This Java program prompts the user to input the number of rows and columns for a matrix. It then allows the user to enter the elements of the matrix and prints the resulting array. The program utilizes nested loops for both input and output of the matrix elements.

Uploaded by

neelamsahun41
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

import java.util.

*;

public class matrix

public static void main (String args[])

Scanner br= new Scanner (System.in);

System.out.println("Enter the no of rows");

int row=br.nextInt();

System.out.println("Enter the no of columns ");

int col=br.nextInt();

int a [] []= new int[row] [col];

//input array elements

System.out.println("Enter"+(row*col)+ "Array Elements");

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

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

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

// Print the array elements

System.out.println("The array is :\n");

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

{
for(int j=0;j<col;j++)

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

System.out.println();

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy