반응형
#include<stdio.h>
int main()
{
	int qty, cost, result;
	
	printf("판매수량? ");
	scanf("%d", &qty);
	
	printf("단가? ");
	scanf("%d", &cost);
	
	if(qty*cost > 1000000)
		result = (qty*cost)-(qty*cost*5e-2);
	else 
		result = qty*cost;
		
	printf("판매금액 : %d \n", result);
	
	return 0;
}
/*
판매수량? 50
단가? 15000
판매금액 : 750000

--------------------------------
Process exited after 4.065 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .

판매수량? 100
단가? 15000
판매금액 : 1425000

--------------------------------
Process exited after 6.397 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/
반응형

'C, C++ > 든든한 c programming 단계별 workbook' 카테고리의 다른 글

Chapter 2 중급 3  (2) 2019.08.26
Chapter2 중급 1  (0) 2019.08.26
Chapter 3 초급 2  (0) 2019.08.24
Chapter3 초급 1  (0) 2019.08.24
Chapter 2 고급2  (0) 2019.08.24

+ Recent posts