In C++ language i had made a factorial computing small program . But it is not working well .plzz help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In C++ language i had made a factorial computing small program . But it is not working well .plzz help

if I would put small inputs like 5,6,10 or even 20 . it works well but on putting higher numbers it computes wrong and gives 0 as an answer .plzz help ...it is in C++ language and tested both on smartphone as well as on pc .

30th Jul 2018, 4:01 PM
Abhishek kumar
Abhishek kumar - avatar
9 Answers
0
there is no issue with your logic if it's working for smaller number.. 20! is so long number which is not hold by int data type.. use data type as long long or long double and u will be done..
30th Jul 2018, 4:05 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
ohh thanks sir
30th Jul 2018, 4:07 PM
Abhishek kumar
Abhishek kumar - avatar
0
sir did you joined some grp on whatsapp or any media where only coding purpose q/ans takes place .
30th Jul 2018, 4:08 PM
Abhishek kumar
Abhishek kumar - avatar
0
I think this is the best platform to get answer from others or help to other if v know something which may help to other... For me, WhatsApp is for fun not for learning ...
30th Jul 2018, 4:16 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
sir is GNU compiler supports long long long data type ?
30th Jul 2018, 4:18 PM
Abhishek kumar
Abhishek kumar - avatar
30th Jul 2018, 4:21 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
thanks alot sir .
30th Jul 2018, 4:25 PM
Abhishek kumar
Abhishek kumar - avatar
0
sir always stay with us (learners) .
30th Jul 2018, 4:26 PM
Abhishek kumar
Abhishek kumar - avatar
0
happy to help
30th Jul 2018, 6:13 PM
Ketan Lalcheta
Ketan Lalcheta - avatar