#include <stdio.h>
#include <stdlib.h>

int main() {
    FILE *fp;
    int num, count = 0;

    fp = fopen("wj002.txt", "r");
    if(fp == NULL) {
        printf("文件打开失败!\n");
        exit(1);
    }

    for(int i = 1; i <= 1000; i++) {
        fscanf(fp, "%d", &num);
        if(i >= 51 && i <= 1000 && num % 10 == 6) {
            count++;
        }
    }

    printf("在第51个-第1000个数据之间,末位数字是6的个数为:%d\n", count);

    fclose(fp);
    return 0;
}
下载由正整数组成的数据交件 wj002 txt 到自己的机器中编写程序统计出该数据交件中在第51 个-第1000 个数据之间末位数字是6的个数。用c语言解决问题

原文地址: https://www.cveoy.top/t/topic/co3u 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录