题目:
输出7和7的倍数,还有包含7的数字例如(17,27,37...70,71,72,73...)
Input
一个整数N。(N不大于30000)
Output
从小到大排列的不大于N的与7有关的数字,每行一个。
Sample Input
20
Sample Output
7
14
17
////C代码
#include <stdio.h>
int main()
{
int i,N;
scanf("%d",&N);
for (i = 1; i <= N; i++)
{
if (i % 7 == 0) printf("%d\n",i);
else
{
int temp = i;
while (temp > 0)
{
if (temp % 10 == 7)
{
printf("%d\n",i);
break;
}
temp = temp / 10;
}
}
}
}