C语言填空:判断n天后为周几

/*假设今天是星期天,编写程序,求1、2、3、4、5、6天后 是星期几(用英文)? */
#include <stdio.h>
main()
{
    char1】;
    int xh;
    scanf("%d",【2】);
printf("%d天后是%s",xh,【3】);
}
/*假设今天是星期天,编写程序,求1、2、3、4、5、6天后 是星期几(用英文)? */
#include <stdio.h>
main()
{
    char ab[7][10]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
    int xh;
    scanf("%d",&xh);
printf("%d天后是%s",xh,ab[xh-1]);
}

 

/*假设今天是星期天,编写程序,求n天后 是星期几(用英文)? */
#include <stdio.h>
main()
{
    char1】;
    int xh,a;
    scanf("%d",【2】);
    a=【3】;
printf("%d天后是%s",xh,ab[a]);
}
/*假设今天是星期天,编写程序,求n天后 是星期几(用英文)? */
#include <stdio.h>
main()
{
    char ab[7][10]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
    int xh,a;
    scanf("%d",&xh);
    a=xh%7;
printf("%d天后是%s",xh,ab[a]);
}

 

posted @ 2023-02-08 05:49  myrj  阅读(1093)  评论(0编辑  收藏  举报