How to solve this error??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
4th Sep 2018, 4:57 AM
Prince Verma
Prince Verma - avatar
4 Answers
+ 5
Prince Verma Solution : ๐Ÿ’— ๐Ÿค—๐Ÿ™†โ€โ™‚๏ธ https://code.sololearn.com/cznqhMy4E0En/?ref=app
5th Sep 2018, 6:49 AM
NimWing Yuan
NimWing Yuan - avatar
+ 4
The error shown is caused because you are trying to return a value without specifying a return type, public static int factorial(int n) There are a couple other errors to fix. Try to solve those on your own but if you get stuck ill post them
4th Sep 2018, 5:14 AM
JME
+ 4
Prince Verma : ๐Ÿ’— ๐Ÿค—๐Ÿ™†โ€โ™‚๏ธ Example : factorial (3) n=3 value=factorial(n-1)*n value=factorial(3-1)*3 value=factorial(2)*3 n=2 value=factorial(n-1)*n*3 value=factorial(2-1)*2*3 value=factorial(1)*2*3 value=1*2*3 value=6
5th Sep 2018, 7:01 AM
NimWing Yuan
NimWing Yuan - avatar
+ 1
wow wow thanks but can you explain me what about after return 1;
5th Sep 2018, 6:52 AM
Prince Verma
Prince Verma - avatar