Examples of the use of a triangular array with data input from the keyboard


import javax.swing .*;
public class MatSegitigaIn
(
public static void main (String [] args)
(
int [] [] x = new int [4] [];
x [0] = new int [1];
x [1] = new int [2];
x [2] = new int [3];
x [3] = new int [4];

int i, j;
for (i = 0; i <4; i + +) (
for (j = 0, j
String number = JOptionPane.showInputDialog (“Enter value:”);
x [i] [j] = Integer.parseInt (number);
)
)

/ / Display array values
for (i = 0; i <4; i + +) (
for (j = 0, j

System.out.print (x [i] [j] + “”);
System.out.println ();
)
System.exit (0);
)
)

One thought on “Examples of the use of a triangular array with data input from the keyboard

Leave a comment