How to find 2¹⁰²⁴
The answer is correct. its 309 digit answer!!
I didn’t found any datatype in java compatible with this range
I tried
long
having range
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
but still not found answer
>Solution :
Its easy..
it’s easy to find.. lets see..
Your answer is :
The answer is correct. its 309 digit answer!!
179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216
its java program is
import java.math.BigInteger;
import java.util.Scanner;
public class powerOfNumber {
public static String findPower(int s){
BigInteger b= BigInteger.valueOf(s);
BigInteger num= BigInteger.valueOf(2);
BigInteger product= BigInteger.valueOf(1);
for (int i = 1; i <= b.intValue(); i++) {
product=product.multiply(num);
}
return product.toString();
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int s= sc.nextInt();
System.out.println(findPower(s));
}
}