SHARE
TWEET

Untitled

a guest Jun 19th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Mocnina {
  2.  
  3.     /**
  4.      * @param args the command line arguments
  5.      */
  6.     public static void main(String[] args) {
  7.         System.out.println ("Zadej číslo ");
  8.         Scanner sc1 = new Scanner (System.in);
  9.         int cislo = sc1.nextInt();
  10.         System.out.println ("zadej mocninu");
  11.         Scanner sc2 = new Scanner (System.in);
  12.         int moc = sc2.nextInt();
  13.         umocni(cislo, moc);
  14.        
  15.     }
  16.     public static void umocni (int cislo, int moc){
  17.         int pomocna = cislo;
  18.         if (moc == 0){
  19.             System.out.println("1");
  20.         }
  21.         else{
  22.             for (int i = 1; i < moc; i++){
  23.             cislo = cislo * pomocna;
  24.             }
  25.         System.out.println(cislo);
  26.         }
  27.     }
  28.            
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top