编写几个C程序问题一:编写一个完整的程序,运行时向用户提问:“你考试考了多少分?(0~100)”,接收输入后判断其等级并

1个回答

  • 1.

    #include

    #include

    int main()

    {

    int score;

    printf("你考试考了多少分?(0~100)n");

    scanf("%d",&score);

    if (score100)

    {

    printf("你输入的数据不合法!n");

    system("pause");

    return 0;

    }

    switch(score/10)

    {

    case 1: case 2: case 3: case 4: case 5:

    printf("差n");

    break;

    case 6: case 7:

    printf("中n");

    break;

    case 8:

    printf("良n");

    break;

    case 9: case 10:

    printf("优n");

    break;

    }

    system("pause");

    }

    2.

    #include

    #include

    int main()

    {

    int month;

    printf("请输入月份!n");

    scanf("%d",&month);

    if(month>12||month