Sie sind auf Seite 1von 1

package shafa2;

import java.util.Scanner;

public class Shafa2 {

public static void main(String[] args) {


Scanner cin= new Scanner(System.in);
int sum=0, a=0;

System.out.println("Enter Number:");
int x = cin.nextInt();
while(x>0){
a=x%10;
x=x/10;
sum+=a;
}
System.out.println("the sumation this number is " + sum);

}
}

Das könnte Ihnen auch gefallen