Question: This is java problem how to get int into char 2d array this is the formula abs(x2-x1) + abs(y2-y1) x1 = 2 x2 = 12
This is java problem how to get int into char 2d array
this is the formula abs(x2-x1) + abs(y2-y1)
x1 = 2
x2 = 12
y1= 2
y2 = 4
with the formula the expected output is 12 as int but in char i cant get 12 as it is because char is from 0 to 9 only.
how to i make the char array accept 2 digit number?
array[x][y] = (char)('0'+(Math.abs(x2 - x1)) + (Math.abs(y2- y1))) ;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
