+ 4

Can I get a factorial of a number greater than 20?

https://code.sololearn.com/co8yl977nVbX/?ref=app Thanq Mohamed ELomari and Nikhil Dhama Solved the last problem Please help to solve this as well.

1st Jul 2018, 12:46 PM
Mukul
Mukul - avatar
11 Answers
+ 3
you should change the return type of factorial func from int to long long
1st Jul 2018, 12:59 PM
MO ELomari
MO ELomari - avatar
+ 4
change return type of function to long long, it's also better to use unsinged numbers because factorial will always be a positive number, so you can have more range in unsinged long itself, for your func, although you have fact variable of long long type, still it's returning a value in the range of int, update it, and your problem will be solved.
1st Jul 2018, 1:01 PM
Nikhil Dhama
Nikhil Dhama - avatar
+ 3
Thanq u Nikhil Dhama
1st Jul 2018, 1:02 PM
Mukul
Mukul - avatar
+ 2
Thanq u
1st Jul 2018, 1:00 PM
Mukul
Mukul - avatar
+ 1
1st Jul 2018, 5:10 PM
Mukul
Mukul - avatar
0
Ok
1st Jul 2018, 1:00 PM
Mukul
Mukul - avatar
0
Can i get a factorial of a no. more than 20
1st Jul 2018, 1:18 PM
Mukul
Mukul - avatar
1st Jul 2018, 1:42 PM
Mukul
Mukul - avatar
0
I am not able to understand most of it. Actually I am still learning c++. I am on my classes lesson
1st Jul 2018, 1:43 PM
Mukul
Mukul - avatar
0
Yes you can but for that you've to use larger data types
1st Jul 2018, 3:03 PM
Aveek Bhattacharyya
Aveek Bhattacharyya - avatar
1st Jul 2018, 3:45 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar