+ 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.
11 ответов
+ 3
you should change the return type of factorial func from int to long long
+ 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.
+ 3
Thanq u Nikhil Dhama
+ 2
Thanq u
+ 1
Awesome code SagaTheGreat 💯
0
Ok
0
Can i get a factorial of a no. more than 20
0
Thanq Mohamed ELomari
0
I am not able to understand most of it. Actually I am still learning c++. I am on my classes lesson
0
Yes you can but for that you've to use larger data types