输出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
java利用String API实现
public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); if (n <= 30000) { int num = 7; while (num < n) { if ((num + "").contains("7") || num % 7 == 0) { System.out.println(num); } num++; } } }
讯享网

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/132583.html