Comment trouver certains chiffres en Java
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int num = input.nextInt();
int sum = 0;
while (num > 0) {
sum += num % 10;
num /= 10;
}
System.out.println("sum of digits: " + sum);
}
Chathumal Sangeeth