0

What is the Output of this code?

int n=15,s=0,x; for(int i=0; i<=n; i++){ x=n%10; s=s+x; n=n/10; } System.out.println(s);

24th Feb 2021, 8:47 AM
Rishabh Bhadani
Rishabh Bhadani - avatar
2 Answers
+ 4
Major just saying,i don't think you should answer for such questions, they can run the program themselves and check the output . If they want an explanation or want to know where to run the code then they should format it to ask about that specifically , no need to do others work!!.
24th Feb 2021, 8:58 AM
Abhay
Abhay - avatar
+ 3
Ok thank you for the info Abhay, I will delete the answer. Thanks, now Ive learned something new, I'll keep it in mind. :)
24th Feb 2021, 9:00 AM
Matthew
Matthew - avatar