返回列表 發帖
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("Input:");
                int o=e.nextInt();
               
               
                 while( o!=999)
             {
                int w=e.nextInt();
               
                System.out.println(powerOf (o, w));
                           o = e.nextInt();
                          
             }
          }          
               
       

                static int powerOf  (int m,int n) {
                        int g=1;
                        while(n>0)
                        {
                                g=g*m;
                                n--;
                        }
                        return g;
                         
                }
                       
               
        }

TOP

返回列表