# help me how to convert it to "2d to 1d"

• October 12th, 2011, 06:10 PM
maryzark19
help me how to convert it to "2d to 1d"
import java.io.*;
public class Dionisio_RProgram2 {
public static void print_array(int[][] numbers)
{

for (int i=1; i<numbers.length; i++) {
System.out.print("" + i + " |");
for (int a=1; a<numbers[i].length; a++)
System.out.print("\t" + numbers[i][a]);
System.out.println(); }

}

public static void main(String[] args) throws IOException {

String yesno="u";
boolean isExit=false;

do{

String row, column;
int Columns = 0;
int Rows = 0;
System.out.print("\n");
System.out.print("ENTER A NUMBER : ");
Rows= Integer.parseInt( row );

int values[][] = new int[Rows+1][Rows+1];
int [][] m = new int[Rows][];
for (int i=0; i < Rows; i++)
m[i] = new int[Rows];
for (int i=0; i < values.length; i++)
for (int a=0; a < values[i].length; a++)
values[i][a] = i*a;
System.out.print("\n");
for (int i=0; i < values.length; i++){
System.out.print(" " + i + " ");
}
System.out.println();
for (int i=0; i < values.length; i++){
System.out.print("" + "" + "---");
}
System.out.println();
print_array(values);
System.out.print("\n\n");

System.out.println("Try again (press 1 if yes/press 2 if no)?");

if(yesno.equalsIgnoreCase("1")) {
isExit=false;
} else if(yesno.equalsIgnoreCase("2")) {
isExit=true;
}

}while(!isExit);
System.out.print("Goodbye!");

}
}
• October 12th, 2011, 07:27 PM
copeg
Re: help me how to convert it to "2d to 1d"
Well, since this is marked as solved I take it that it is solved. But for the record, I recommend reading the following:
http://www.javaprogrammingforums.com...-get-help.html