Sum of first n natural numbers code in java July 8, 2019 16 32 64 128 Sum of first n natural numbers How to calculate sum of digits in java