VAIBHAV NIRMAL

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

--

--

Java Program :

pallindromeDayOne.javapublic class pallindromeDayOne {
public static boolean checkPallindrome(String str){
boolean res=false;
if (str.length()==0||str.length()==1) return res;

int start = 0, end = str.length()-1;
while (start<end){
res= str.charAt(start) == str.charAt(end);
start++; end--;
}
return res;
}
public static void main(String[] args) {
System.out.println(checkPallindrome("abckcba")? "string is palindrome":"not palindrome" );
}
}

simplified and extended program :

public class pallindromeDayOne {
public static boolean checkPallindrome(String str){
boolean res=false;
if (str.length()==0||str.length()==1) return res;

int start = 0, end = str.length()-1;
while (start<end){
if (str.charAt(start) == str.charAt(end)) {
res = true;
} else {
res = false;
}
start++; end--;
}
return res;
}
public static void main(String[] args) {
if (checkPallindrome("abckcba")== true) {
System.out.println("string is palindrome");
} else {
System.out.println("not palindrome");
}
}
}

--

--

VAIBHAV NIRMAL

VAIBHAV NIRMAL

Heyy.. there.. myself Vaibhav I am a student programmer and web Developer. Things are not simple as we think so I believe in making things as simple as I want!