import java.util.Scanner;
public class my
{
public static void main(String args[])
{ int st,rem=0;
Scanner s= new Scanner(System.in);
System.out.println("Enter the number");
st= s.nextInt();
while(st!=0)
{
rem = rem + st%10;
st=st/10;
}
System.out.println("the sum of the given no. is" +rem);
}
}
Comments
Post a Comment