Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/merttalug/digitsum
A program that calculates the sum of the digits of a number.
https://github.com/merttalug/digitsum
digits java kodluyoruz patika-dev
Last synced: about 2 months ago
JSON representation
A program that calculates the sum of the digits of a number.
- Host: GitHub
- URL: https://github.com/merttalug/digitsum
- Owner: merttalug
- License: mit
- Created: 2022-03-11T15:04:48.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-11T15:07:43.000Z (almost 3 years ago)
- Last Synced: 2023-07-14T14:12:18.664Z (over 1 year ago)
- Topics: digits, java, kodluyoruz, patika-dev
- Language: Java
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DigitSum
A program that calculates the sum of the digits of a number.
* For e.g. 1643 = 1 + 6 + 4 + 3 = 14## Scope Block Sample
```
do {
System.out.println("Please enter a number: ");
num = input.nextInt();
if (num >= 0) {
asknum = true;
}
}
while (!asknum);fakenum = num;
while (fakenum != 0) {
digitval = fakenum % 10;
result += digitval;
fakenum /= 10;
}System.out.println("The sum of the digits of the number "+num+" is: "+result);
```