Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
program that takes a 5 digit number and calculates 2 power that number and prints it.
Posted
Updated 6-Aug-10 4:17am
v2
Comments
Smithers-Jones 6-Aug-10 10:18am    
Reason for my vote of 1
I believe this will, as the other questions from Laxmikanth1234, be deleted within minutes.
Dylan Morley 6-Aug-10 10:18am    
yes it is possible, you will have fun solving it
Dalek Dave 6-Aug-10 10:32am    
I believe it should be kept in a Q&A Hell Archive!
Yusuf 6-Aug-10 10:46am    
Reason for my vote of 1
can't you learn something from your class?
Smithers-Jones 6-Aug-10 10:56am    
Reason for my vote of 1
laxmikanth is a moron, who, despite people telling him to do his homework himself, keeps posting the same bullsh*t over and over again.

1 solution

[Edited for a big fix: thanks to Richard (see its comment) ;P ]

5 digits could be up to 99999, which in binary is 1 followed by 99999 zeroes and 2^99999 in binary is 2 followed by 99999 zeroes: is a very huge number, in decimal is about 4.995e+30102! 100000 bit requires 12500 bytes!

There are libraries able to deal with number of these sizes, and they are used for example in asymmetric-cryptography, like in the RSA algorithm.

If you are interested in them, you could google for "bigint + C++": http://www.google.it/search?hl=it&source=hp&q=bigint+%2B+c%2B%2B&cts=1281104483843&aq=f&aqi=g1&aql=&oq=&gs_rfai=[^]
 
Share this answer
 
v2
Comments
Richard MacCutchan 6-Aug-10 10:55am    
"99999 which in binary is 1 followed by 99999 zeroes": I don't think so, it's actually 1 1000 0110 1001 1111.
Sauro Viti 6-Aug-10 11:14am    
:-O Thank you Richard! It's 2^99999 that in binary is 1 followed by 99999 zeroes!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900