How to find 2¹⁰²⁴

--

what is value of 2¹⁰²⁴?

it's easy to find.. lets see..

Your answer is :

179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216

it's not a joke, The answer is correct. its 309 digit answer!!

Let's learn how to do such a big calculation .. And the answer is “Programing” yes programming. Nothing is impossible for programmer!!

Java Program to find the 1024th power of 2



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));
}
}

Output:

179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216

--

--

VAIBHAV NIRMAL
VAIBHAV NIRMAL

Written by VAIBHAV NIRMAL

Hi there.. This is Vaibhav. A Passionate Software Developer. I'm all about creating cool stuff with code.