0

How to print the added value?

I tried changing the code as follows: 1. made the return type int instead of void for method addOneto 2. added "return num;" at the end of that method I thought doing this make the code print 6, but it only printed 5. why is that? what should I do to make it print 6? https://code.sololearn.com/czSzBe74jD8Y/?ref=app

3rd Sep 2018, 9:23 PM
ADIL KHAN
ADIL KHAN - avatar
2 Respostas
0
You need to set the returned value to a variable: x = addOneTo(x);
3rd Sep 2018, 9:41 PM
Matthias
Matthias - avatar
0
Matthias thanks a lot... ✌️✌️
3rd Sep 2018, 9:47 PM
ADIL KHAN
ADIL KHAN - avatar