a147. Print it all
核心:i % 7 == 0? "": i + " "
如果i被7整除就輸出空字串,不整除就輸出i加空白。Yeah
BTW科皓不要
程式碼如下:
/* Pa147.java
* a147. Print it all
*
* 我的意思是說 科皓不要啦
* 2020/3/8
*/
import java.util.Scanner;
public class Pa147{
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
while(scanner.hasNext()){
int n = scanner.nextInt();
for(int i = 1; i < n; i++){
System.out.print(i % 7 == 0? "": i + " ");
}
System.out.println();
}
}
}

