/**
* 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.
*/
-
Notifications
You must be signed in to change notification settings - Fork 0
Adhouma/DigitSum-challenge
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Java DigitSum challenge
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published