import java.io.*; class Sum1 { int total = 0, remainder; public void add(int num) { while (num > 0) { remainder = num % 10; total = total + remainder; num = num / 10; } System.out.println("Sum of the digits in the given number is:" + total); } } class Summain { public static void main(String args[]) throws IOException { int num; Sum1 s1 = new Sum1(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("\nEnter the number:"); num = Integer.parseInt(br.readLine()); s1.add(num); } }