今天学习了如何分两种情况输出星期
#include <stdio.h>
int main()
{
int a,b,c;
scanf("%d",&a);
if(a+2>7){
b=a+2,c=b%7;
printf("%d",c);
}
else{
c=a+2;
printf("%d",c);
}
return 0;
}
运行结果如下:
6
1
--------------------------------
Process exited after 4.448 seconds with return value 0
请按任意键继续. . .
7
2
--------------------------------
Process exited after 1.678 seconds with return value 0
请按任意键继续. . .