Skip to content

Adhouma/DigitSum-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DigitSum challenge

/**
 * Write a method with the name sumDigits that has one int parameter called
 * number. If parameter is >= 10 then the method should process the number and
 * return sum of all digits, otherwise return -1 to indicate an invalid value.
 * 
 * The numbers from 0-9 have 1 digit so we don't want to process them, also we
 * don't want to process negative numbers, so also return -1 for negative
 * numbers.
 * 
 * For example calling the method sumDigits(125) should return 8 since 1 + 2 + 5 = 8.
 * Calling the method sumDigits(1) should return -1 as per requirements described above.
 */

Releases

No releases published

Packages

No packages published

Languages