返回列表 發帖
package terror;

import java.util.Scanner;

public class rrrrr {
         static Scanner e = new Scanner(System.in);
            
        public static void main(String[] args) {
                // TODO 自動產生的方法 Stub

                test();
                test();
                test();
                test();
        }

        private static void test() {
                // TODO 自動產生的方法 Stub
                int p = 1;
                System.out.println("Please enter one value:");
                int o=e.nextInt();
                if(o>=1 && o<=10)
                {
                 for(int k=1;k<=o;k++)
             {
                  
                                p=p*k;
                          
             }
                          System.out.println(o+"!="+p);
                }
                else
                {
                        System.out.println("Error,the value is out of range.");
                }
        }       

}

TOP

返回列表