[Asm] 纯文本查看 复制代码
/*
/*7.个位数是6,且能被3整除的五位数共有多少个。
*/
#include<stdio.h>
#include<stdlib.h>
//+1
void main1() {
int length = 0;;
for (int i = 10000; i < 99999; i++) {
if (i % 10 == 6 && i % 3 == 0) {
length++;
}
}
printf("%d", length);
getchar();
}
//+3
void main2() {
int length = 0;;
for (int i = 9999; i < 99999; i+=3) {
if (i % 10 == 6) {
length++;
}
}
printf("%d", length);
getchar();
}
//+10
void main3() {
int length = 0;;
for (int i = 10006; i <= 99996; i += 10) {
if (i % 3 == 0) {
length++;
}
}
printf("%d", length);
getchar();
} |