1. #include
  2. #define week 7
  3.  
  4. int main(void) {
  5. int days;
  6. printf("날을 입력해주세요\n");
  7. scanf("%d%", &days);
  8. while (days > 0)
  9. {
  10. printf("%d일은 %d주, %d일입니다.", days, days / week, days % week);
  11. printf("다시 숫자를 입력해주세요. 0이나 음수를 입력하면 프로그램을 종료합니다.\n");
  12. scanf("%d", &days);
  13. }
  14. return 0;
  15. }


/* Programming Exercise 5-3 */

#include

int main(void)

{

const int daysperweek = 7;

int days, weeks, day_rem;

printf("Enter the number of days: ");

scanf("%d", &days);

while (days > 0)

{

weeks = days / daysperweek;

day_rem = days ysperweek;

printf("ays are %d weeks and ays.\n",

days, weeks, day_rem);

printf("Enter the number of days (0 or less to end): ");

scanf("%d", &days);

}

printf("Done!\n");

return 0;

}



위에는 문제보고 제가 푼거고


아래는 답지인데요


사실 저도 맞은 것 같은데 아래는 weeks랑  day_rem 변수를 선언해서 전달인수에 변수를 넣었더라구요


저는 전달인수에 수식을 넣었는데 아래처럼 하는게 더 좋거나 프로그램이 빠르다거나 있나요 ?