+ 1

A java code that find s power of any number

Example 2^9=512 9^2=81 5^3=125

3rd Apr 2021, 3:29 PM
Atul Jangid
Atul Jangid - avatar
5 Respuestas
3rd Apr 2021, 4:15 PM
Atul [Inactive]
+ 2
🅰🅹 (16 * 7 Available) It will be better if you also mention the base(a) and the power(b) also, using comments
4th Apr 2021, 7:06 AM
Atul [Inactive]
+ 2
Thanks all of you
4th Apr 2021, 9:09 AM
Atul Jangid
Atul Jangid - avatar
+ 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); } }
3rd Apr 2021, 6:54 PM
A͢J
A͢J - avatar
0
Atul Well he can understand.
4th Apr 2021, 7:08 AM
A͢J
A͢J - avatar