corecraftsysteme / corecraftsysteme/studious-winner

Two Darray

Open
#1 0 comments 0 reactions 1 assignee Claimed by @corecraftsysteme View on GitHub
documentation
Dominant language
No language data
Stars
1
Forks
7
PR merge metrics
No merged PRs in 30d

Description

import java.util.*;

class TwoDArray
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
System.out.print("Enter # of rows: ");
int rows = scanner.nextInt();
System.out.print("Enter # of cols: ");
int cols = scanner.nextInt();

int[][] a = new int[rows][cols];

System.out.print("Enter " + rows + "x" + cols + "=" + (rows * cols) + " integers: ");
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
a[i][j] = scanner.nextInt();
}
}

System.out.println("Here are those " + (rows * cols) + " integers in a " + rows + "x" + cols + " 2d-array:");
System.out.println(Arrays.deepToString(a));
}
}

My lesson highlights! Check it out on your phone in Programming Hub: https://goo.gl/D2iETN

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.