Why my pc get wrong output of factorial upto 13. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why my pc get wrong output of factorial upto 13.

In my phone it's work properly but only on pc problem https://code.sololearn.com/cYa9g75LHov2/?ref=app

4th Dec 2021, 2:07 PM
PARMAR AAYUSH
PARMAR AAYUSH - avatar
4 Answers
+ 2
Try this: long factorial(long n)
4th Dec 2021, 2:24 PM
JaScript
JaScript - avatar
+ 2
In your phone may be it working but its depend on compiler . If you will use modern compiler gnu gcc ,llvm , clang then it will give you errors because implicit main is removed in c99 as long years ago its deprecated and cpp is more strict than so may be in c it can work but in cpp its completely error . You can int main() instead of void if you using clang then u can write int main with command line arguments or simply int main it will also work if you are on mac the. U can write like _tmain(command line arguments) With return type main u need to use return statement at the end of program its depend on your function return type for more details you can search on Google In cpp there u can define like this auto main() ->int this will also work fine
4th Dec 2021, 6:07 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
Inactive please understand my question. I know void main not work but my question is why its output of this factorial is wrong up to 13.... In computer but in phone its work properly.
5th Dec 2021, 12:29 AM
PARMAR AAYUSH
PARMAR AAYUSH - avatar
0
No it's not work 😞
5th Dec 2021, 10:24 AM
PARMAR AAYUSH
PARMAR AAYUSH - avatar