编程练习 5.11 3
编写一个程序,提示用户输入天数,然后将其转换成周数和天数。例 如,用户输入18,则转换成2周4天。
#include <stdio.h>
int main() {
const int days = 7;
int day, week, day_Left;
printf("Please enter the number of the days, we will convert it into weeks and days: ");
scanf("%d", &day);
week = day / days;
day_Left = day % days;
printf("Your %d days are %d weeks and %d days left.", day, week, day_Left);
return 0;
}

浙公网安备 33010602011771号