回覆列表
  • 1 # 使用者566759068971

    import java.util.Scanner;

    public class test1 {

    private static Scanner input= new Scanner(System.in);

    public static void main(String[] args){

    long num;

    do{

    System.out.print("\nInput your num: ");

    num=input.nextLong();

    }while(num<10000||num>99999);

    num=num/100;

    num*=100;

    System.out.println("\nThis is num: "+num);

    }

    }

    import java.util.Scanner;

    public class test2 {

    private static Scanner input= new Scanner(System.in);

    public static void main(String[] args){

    long num;

    do{

    System.out.print("\nInput your num: ");

    num=input.nextLong();

    }while(num<0||num>1000);

    int sum=0;

    while(num>0){

    sum+=num%10;

    num/=10;

    }

    System.out.println("\nThis is sum: "+sum);

    }

    }

  • 中秋節和大豐收的關聯?
  • 寧研518玉米種怎麼樣?