#include <stdio.h>

int main() { int count = 0; for (int i = 100; i < 100000; i++) { int a = i / 100; // 前3位 int b = i / 10 % 100; // 中间3位 int c = i % 1000; // 后3位 if (a % 6 == 0 && b % 7 == 0 && c % 9 == 0) { printf('%d ', i); count++; } } printf("\n共有%d个数符合条件。\n", count); return 0; }

C语言实现:满足特定条件的5位整数统计

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

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