# Two Dimensional Array Code Java

## Two dimensional array code for converting the input number to words of langage: e.g: Input: 102 Output: One hundred two.

int [][] p={
{10,20,30},
{40,50,60},
{70,80,90}
};

//for(int i=0; i<3 ; i++){
for(int j=0; j<3; j++){
//if(j<j-1)
print(”n ” + p[j][j]);
}
println();

String [] a = {”",”one”,”two”,”three”,”four”,”five”,”six”,”seven”,
“eight”,”nine”,”ten”,”eleven”,”twelve”,”thirteen”,”fourteen”};

String [] b ={ “”, “Ten”, “Twenty”, “Thirty”, “Fourty”, “Fifty”,
“Sixty”, “Seventy”, “Eighty”, “Ninety”};

int[] digits = new int [5];
int x=73458;
for(int i=4; i>=0; i–){
digits[i]= x%10;
x = x/10;
}

print(” ” + b[digits[0]]);
print(” ” + a[digits[1]]);

String[] a={”",”ONE”,”TWO”,”THREE”,”FOUR”,”FIVE”,”SIX”,”SEVEN”,
“EIGHT”,”NINE”,”TEN”,”ELEVEN”,”TWELVE”,”THIRTEEN”,”FOURTEEN”,
“FIFTEEN”,”SIXTEEN”,”SEVENTEEN”,”EIGHTEEN”,”NINETEEN”};
String[] b={”",”TEN”,”TWENTY”,”THIRTY”,”FOURTY”,”FIFTY”,”SIXTY”,
“SEVENTY”,”EIGHTY”,”NINETY”};

String[] c={”",”",”",”",”",”",};

int[] digits=new int[5];
int x= 73845;
for(int i=4; i>=0; i–){
digits[i] = x%10;
x = x/10;
}

print(” ” + b[digits[0]]);
print(” ” + a[digits[1]]);
print(” ” + c[digits[1]]);
print(” ” + b[digits[0]]);

0
Liked it
No Responses to “Two Dimensional Array Code Java”
Post Comment