Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pętlee9;
- import java.util.Scanner;
- public class PętleE9 {
- public static void main(String[] args) {
- int licznik =1 ,n ;
- double x, potęga=1;
- Scanner sc = new Scanner(System.in);
- System.out.println("Podaj x");
- x=sc.nextInt(); sc.nextLine();
- System.out.println("Podaj n");
- n=sc.nextInt(); sc.nextLine();
- while(licznik <= n) {
- potęga *= x;
- licznik += 1;
- }
- System.out.println("Potęga= " + potęga);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement