+ 1
A java code that find s power of any number
Example 2^9=512 9^2=81 5^3=125
5 Antworten
+ 2
https://code.sololearn.com/cC2QxLYO23Oa/?ref=app
Hope this code helps you
+ 2
🅰🅹 (16 * 7 Available) It will be better if you also mention the base(a) and the power(b) also, using comments
+ 2
Thanks all of you
+ 1
Atul Jangid
Without using inbuilt method
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int pow = 1;
for (int i = 0; i < b; i++) {
pow = pow * a;
}
System.out.println (pow);
}
}
0
Atul Well he can understand.