[Java] 받은 돈과 상품 가격을 입력 시, 부가세/ 잔돈 출력하는 프로그램 만들기_상점 영수증

JTI·2022년 9월 30일
0

📌 Code list

목록 보기
2/55
post-thumbnail

상점에 가면 우리는 상품에 대한 돈을 내고 영수증을 받는다.
영수증에는 10% 부가세와 잔돈 등이 인쇄되어 있다.
구입한 상품의 가격과 손님한테 받은 금액을 입력하면 부가세와 잔돈을 출력하는 프로그램을 작성하여 보자.

📍codding_java

import java.util.Scanner;

public class Money {
	public static void main(String[] args) {
		
        Scanner sc = new Scanner(System.in);
		
		int m;
		System.out.print("받을 돈: ");
		m = sc.nextInt();

		int count;
		System.out.print("상품 가격: ");
		count = sc.nextInt();

		System.out.println("부가세: " + (count / 10));
		System.out.println("잔돈: " + (m - count));		

	}

}

profile
Fill in my own colorful colors🎨

0개의 댓글