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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s