C语言代码优化:统计两个数之间个位数为0的数字个数
#include <stdio.h> #include <stdlib.h>
/* 统计两个数之间个位数为0的数字个数 */
int main(int argc, char *argv[]) { int a, b, i; int n = 0; printf("请输入两个数,用空格分隔:\n"); scanf("%d %d", &a, &b); for (i = a; i <= b; i++) { if (i % 10 == 0) { n++; } } printf("在%d和%d之间,个位数是0的数的个数为:%d\n", a, b, n); return 0; }
原文地址: https://www.cveoy.top/t/topic/oZPq 著作权归作者所有。请勿转载和采集!