#include <stdio.h>
main()
{
int i = 0;
int j = 0;
int sum = 0;
int temp = 0;
int count = 0;
printf("结果能被5整除的数有:\n");
for (i=100; i<=999; i++)
{
temp = i;
for (j=0; j<3; j++)
{
sum += (temp%10);
temp /= 10;
}
if(0 == (sum%5))
{
count++;
printf("%d ", i);
}
sum = 0;
}
printf("\n共%d个\n", count);
system("pause");
return 0;
}
运行结果:

