Padd Solutions

Converted by Falcon Hive

import java.util.Scanner;

public class Power
{
    public static void main (String[] args)
    {
        Scanner scan = new Scanner (System.in);
        int base, power, result;
       
        System.out.print ("Please enter a base number: ");
        base = scan.nextInt ();
       
        System.out.print ("Please enter a power: ");
        power = scan.nextInt ();
       
        result = base;
       
        while (power > 1)
        {
            power--;
           
            result *= base;
        }
       
        System.out.println ();
        System.out.println ("It's totally "+result+". How could you not know that?!");
    }
}

(0) Comments

Post a Comment