蹲一蹲这一个要怎么做

img


应该是很简单的,但是搞不懂怎么可以连续输入两次数据,一个晚上都没懂,谢谢大家了

帮你写了一个,把num换成你的学号,name换成你的姓名,运行一下即可(或者你评论下,我帮你算)

#include <stdio.h>
#include <string.h>
#include <math.h>

int main()
{
    int num = 12345;
    char name[30] = "zhang san";

    int last_digit = num % 10;
    printf("学号最后一位: %d\n", last_digit);

    char *last_name = strrchr(name, ' ') + 1;
    printf("姓名最后一个单词的首字母: %c\n", last_name[0]);

    double radius = last_digit + (int)(last_name[0]);
    double circumference = 2 * 3.14 * radius;
    printf("圆周长为: %8.3f\n", circumference);
    return 0;
}