Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PotenssienSumma {
- public static void main(String[] args) {
- Scanner lukija = new Scanner(System.in);
- System.out.print("Anna luku: ");
- int potenssi = Integer.parseInt(lukija.nextLine());
- int luku = 2;
- while (potenssi >= 0) {
- (Math.pow(luku, potenssi)) + (math.pow(luku, potenssi++));
- }
- int tulos = (int) Math.pow(luku, potenssi);
- System.out.print("Tulos on: " + tulos);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement