1
I made a basic program about calculating potentiation, but when it comes to while
crash, and until the terminal I have to restart. So I can’t continue the program. I even tried to change the way the scanner looked but I realized it was the while
even.
import java.util.Scanner;
int c = 0; //contador
int p = 1; //potencia
int a;
int b;
Scanner input = new Scanner(System.in);
System.out.println("Digite o valor da base:");
a = input.nextInt();
System.out.println("Digite o valor do expoente:");
b = input.nextInt();
while (c != b){
p = p * a;
c = c++;
}
System.out.printf("A potencia de int %d como base e int %d como expoente eh: %d\n",a, b, p);
input.close();
}
On the first line where
C++
would not beJava
?– Augusto Vasques
No :D Look at the original code of the question, it has a
c++
:)– Maniero