a147: Print it all

題目:http://zerojudge.tw/ShowProblem?problemid=a147
程式碼:

import java.util.Scanner;
public class a147 {

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Scanner sc = new Scanner(System.in);
  while(sc.hasNext()){
   int a = sc.nextInt();
   if(a == 0){
    break;
   }
   for(int i=1;i<a;i++){
    if(i%7!=0){
     System.out.print(i+" ");
    }
   }
   System.out.println("");
  }

 }

}

留言

熱門文章