need help #java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

need help #java

how to get sum of digits using loop ...??

29th Dec 2016, 3:39 PM
Janindu Chandopama
Janindu Chandopama - avatar
1 Answer
0
int digit = 0; for (int i = 0; i <= 10; i++) { digit += i; } // digit = 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10
29th Dec 2016, 3:56 PM
Florian Castelain
Florian Castelain - avatar