What is the problem?
The output fits the answer, but why is the task not complete?
package com.codegym.task.task01.task0132;
/*
Sum of the digits of a three-digit number
*/
public class Solution {
public static void main(String[] args) {
System.out.println(sumDigitsInNumber(546));
}
public static int sumDigitsInNumber(int number) {
//write your code here
int i, j, k;
for (i=0; number>100; i++){
number = number -100;
}
for (j=0; number>10; j++){
number = number -10;
}
k = i + j + number;
return k;
}
}