C, C++/든든한 c programming 단계별 workbook
Chapter 3 초급 2
유진
2019. 8. 26. 19:06
반응형
#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
계속하려면 아무 키나 누르십시오 . . .
*/
반응형