I created a file sayilar.txt in it:
1. 5379 2. 5983 3. 3985 4. 2679 5. 1596 6. 3496 7. 8356
I read files into an array, but I cannot figure out how to add a class of units, tens, hundreds, and thousands. What would happen
9+3+5+9+6+6+6 = 44 (единицы) 7+8+8+7+9+9+5 = 53 (десятки) 3+9+9+6+5+4+3 = 39 (сотни) 5+5+3+2+1+3+8 = 27 (тысячи)
The code itself read the file and write to the array:
public static void main(String[] args) throws FileNotFoundException, IOException { BufferedReader in = new BufferedReader(new FileReader("/home/mansur/NetBeansProjects/odev/src/odev/sayilar.txt")); int [] array= new int [7]; String s =in.readLine(); int i = 0; while(s!=null) { try { array[i++] = Integer.parseInt(s); } catch (NumberFormatException ex) { continue; } s = in.readLine(); } in.close(); for(int k = 0; k < array.length; k++){ System.out.println(array[k]); } }
x % 10 > x / 10
- units .... - And