package Ray;
import java.util.Scanner;
/**
*
* @author Marie
*
*/
public class Seven2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while(in.hasNext()){
int num = in.nextInt();
System.out.println(hasSeven(num));
}
}
public static int hasSeven(int num) {
int count = 0;
for (int i = 7; i <= num; i++) {
if (i % 7 == 0) {
count++;
} else {
int temp = i;
while (temp > 0) {
if (temp % 10 == 7) {
count++;
break;
} else {
temp = temp / 10;
}
}
}
}
return count;
}
}刷题之寻找7和7的倍数
最新推荐文章于 2022-10-24 20:30:00 发布
271

被折叠的 条评论
为什么被折叠?



