Advertisement
Varasku

Potęga pętla for

Oct 25th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1.  
  2. package pętlee9;
  3.  
  4. import java.util.Scanner;
  5.  
  6.  
  7. public class PętleE9 {
  8.  
  9. public static void main(String[] args) {
  10. int licznik =1 ,n ;
  11. double x, potęga=1;
  12. Scanner sc = new Scanner(System.in);
  13.  
  14. System.out.println("Podaj x");
  15.  
  16. x=sc.nextInt(); sc.nextLine();
  17. System.out.println("Podaj n");
  18.  
  19. n=sc.nextInt(); sc.nextLine();
  20. for (int i= licznik; i < x; i++){
  21. potęga*= x;
  22. licznik += 1;
  23.  
  24. System.out.println("Potęga " + potęga);
  25. }
  26.  
  27.  
  28.  
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement