import java.util.Arrays; public class test { public static void main(String[] args) { int[] array = { 1000,500, 100, 50, 20, 10, 5, 2, 1 }; int _amt = 12233; int[] _count = new int[array.length]; for (int i=0; i<array.length; i++) { while (_amt>=array[i]) { //System.out.println(array[i]); _count[i]++; _amt -= array[i]; } } System.out.println(Arrays.toString(_count)); } }
-
Blogger Comment
-
Facebook Comment
Subscribe to:
Post Comments
(
Atom
)
0 comments :
Post a Comment