public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int mymoney, pay, result;
int bigfive=0;
int bigten=0;
int midfive=0;
int midten=0;
int smallfive=0;
int smallten=0;
System.out.println("본인 금액을 입력하시오.");
mymoney = sc.nextInt();
System.out.println("지불할 금액을 입력하시오.");
pay = sc.nextInt();
result = mymoney - pay;
bigfive = result / 5000;
bigten = result % 5000 / 1000;
midfive = result % 5000 % 1000 / 500;
midten = result % 5000 % 1000 % 500 / 100;
smallfive = result % 5000 % 1000 % 500 % 100 / 50;
smallten = result % 5000 % 1000 % 500 % 100 % 50 / 10;
System.out.println("5000원 = " + bigfive+"장");
System.out.println("1000원 = " + bigten+"장");
System.out.println("500원 = " + midfive+"장");
System.out.println("100원 = " + midten+"장");
System.out.println("50원 = " + smallfive+"장");
System.out.println("10원 = " + smallten+"장");
}
}