JAVA PROGRAM TO PRINT THE SUM OF DIGITS
In JAVA, the sum of digits can be calculated by using the below program. //SUM OF DIGITS JAVA PROGRAM import java.util.Scanner; public class Main { public static void main (String[] args) { int num,sum =0, temp = 0; //temp and sum are initialized with 0 Scanner snum = new Scanner(System.in); //Scanner class used by creating an object named snum to take input num = snum.nextInt(); // nextInt() is used to read the input from the user System.out.println("your input is " + num); while(num>0) { temp = num%10; sum += temp; num = num /10; ...