This factorial coding breaks after 12!(means it is valid only upto 12!), why this so happen, plz tell me it's solution?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

This factorial coding breaks after 12!(means it is valid only upto 12!), why this so happen, plz tell me it's solution??

https://code.sololearn.com/cjcdya8f9V01/?ref=app

12th May 2021, 3:53 AM
Prakash Jaiswal
Prakash Jaiswal - avatar
5 Answers
+ 2
Hey Prakash Jaiswal Factorials greater 20 can't be stored even in a 64 - bit long variable. following link will help you to code 👇👇 https://www.javatpoint.com/extra-long-factorials-in-c
12th May 2021, 1:48 PM
Giriraj Yalpalwar
Giriraj Yalpalwar - avatar
+ 3
Prakash Jaiswal use "%ld" while printing factorial in your code ! I recommend to use long long int for it !
12th May 2021, 4:02 AM
Giriraj Yalpalwar
Giriraj Yalpalwar - avatar
0
Thank you guys for helping!
12th May 2021, 6:18 AM
Prakash Jaiswal
Prakash Jaiswal - avatar
0
But Thirt13n, when I used urs instruction....I just have valid value upto 20!, why not I get futher or greater factorial value that I needed?
12th May 2021, 1:13 PM
Prakash Jaiswal
Prakash Jaiswal - avatar
0
Thanx again for clearing my doubts... Thirt13n !
12th May 2021, 1:59 PM
Prakash Jaiswal
Prakash Jaiswal - avatar