KOREA University/C2008. 8. 12. 14:59
어느 가게에서 물건을 5000원 이상 사면 10%의 할인을 해준다고 쳤을때, 사용자가 물건값과 개수를 입력하면 지불금액이 계산되는 프로그램입니다. 쪼~끔 머리 굴리면 아주 쉽습니다.


#include <stdio.h>

void main()
{
 int no1, no2, jhs;

 printf("물건값 : ");
 scanf("%d", &no1);

 printf("개수 : ");
 scanf("%d", &no2);

 jhs = no1*no2;

 if (jhs >= 5000)
  printf("금액(할인됨) : %d\n", jhs-(jhs/10));

 else if (jhs < 5000)
  printf("금액(할인안됨) : %d\n", jhs);
}

Posted by 정훈승