Board logo

標題: 204-公倍數計算 [打印本頁]

作者: 許承鴻    時間: 2018-6-19 18:53     標題: 204-公倍數計算

import java.util.*;
class JPD02 {
    static Scanner input = new Scanner(System.in);
    public static void main(String[] args) {
        test();
        test();
    }
  
    public static void test() {
        ...
    }
}
作者: 張閎鈞    時間: 2018-6-19 19:07

  1. import java.util.*;
  2. class JPA01 {
  3.     static Scanner input = new Scanner(System.in);
  4.     public static void main(String[] args) {
  5.         test();
  6.         test();
  7.     }
  8.   
  9.     public static void test() {
  10.             System.out.println("input:");
  11.         int a=input.nextInt();
  12.         if(a%5==0&&a%9==0)
  13.         {
  14.                 System.out.println("Yes");       
  15.                
  16.         }
  17.         else
  18.         {
  19.                 System.out.println("No");
  20.         }
  21.     }
  22. }
複製代碼

作者: 巫沛庭    時間: 2018-6-19 19:13

  1. import java.util.*;
  2.         class JPA02 {
  3.             static Scanner input = new Scanner(System.in);
  4.             public static void main(String[] args) {
  5.                 test();
  6.                 test();
  7.             }
  8.           
  9.             public static void test() {
  10.                 System.out.println("Input : ");
  11.                 int x=input.nextInt();
  12.                 if(x%5==0 && x%9==0)
  13.                 {
  14.                   System.out.println("Yes");
  15.                 }
  16.                 else{
  17.                         System.out.println("No");
  18.                 }
  19.             }
  20.         }
複製代碼

作者: 巫晉宇    時間: 2018-6-19 19:17

import java.util.Scanner;


public class JPA01 {
          static Scanner o= new Scanner(System.in);
        public static void main(String[] args) {
                // TODO 自動產生的方法 Stub
               
                test();
                test();
               
               
               
                       
                }
               
          
        private static void test() {
                // TODO 自動產生的方法 Stub
               
                 System.out.print("input:");
                 int u=o.nextInt();
                if( u%9==0 && u%5==0)
                {
                        System.out.println("yes");
                       
                }
                else
                {
                        System.out.println("no");
                       
                }
        }
       

}




歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/) Powered by Discuz! 7.2