+ 1

Need explanation

output is 4. how it comes? https://code.sololearn.com/c71kADFbcl0d/?ref=app

30th Jun 2018, 6:37 AM
Jay Kumbhani
Jay Kumbhani - avatar
2 Answers
+ 2
hi, first it throws arithmetic exception and catch handles the exception by incrementing n value by 2 so n=8 8/1=8 8/2=4 third iteration so output is 4
30th Jun 2018, 6:46 AM
Nanda Balakrishnan
+ 2
okay, I got it. Thank you.
30th Jun 2018, 6:57 AM
Jay Kumbhani
Jay Kumbhani - avatar