Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package exercicios;
- import java.util.Scanner;
- public class ex13 {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int base,pot;
- System.out.println("Digite o numero da base: ");
- base = sc.nextInt();
- System.out.println("Digite a potencia: ");
- pot = sc.nextInt();
- int resultado = base;
- for(int i = 1; i<pot; i++){
- resultado *= base;
- }
- System.out.println(resultado);
- }
- }
- //faça um programa que peça dois numeros, base e expoente,
- //calcule e mostre o primeiro elevado ao segundo.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement