Is it possible to print numbers with too many digits exactly as it is in C++, without using scientific notation? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it possible to print numbers with too many digits exactly as it is in C++, without using scientific notation?

For example for factorial of 25, I get the following number in windows 10 calculator as: 15511210043330985984000000 Will C++ allow us to display the above number as it is, in the program result, without using scientific notation?

30th Sep 2017, 2:02 PM
Antony Marianathan
Antony Marianathan - avatar
4 Answers
+ 1
Not naturally, you'll have to create (or find on the internet) a class that allow integers to have "unlimited" size :/
30th Sep 2017, 2:09 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
It is often quoted that most Operating systems are coded in C or C++. Assuming that Windows 10, is at least partially developed using C++, and that Windows 10's Calculator App is able to display results with too many digits as it is, I guess there must be a way to write a C++ program that can display fact(25) as it is.
30th Sep 2017, 2:33 PM
Antony Marianathan
Antony Marianathan - avatar
+ 1
It can have been developed by windows programmers
30th Sep 2017, 2:40 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
I found an algorithm for factorial of large numbers at this link : http://www.geeksforgeeks.org/factorial-large-number/ The code did not work in the built in IDE of that site. Made a few corrections in syntax and it worked at sololearn's IDE. For example fact(500) displays as a 1135 digit number.
30th Sep 2017, 3:43 PM
Antony Marianathan
Antony Marianathan - avatar