You’re given an integer N. Write a program to calculate the sum of all the digits of N.

**Input**The input integer N

**Output**

Calculate the sum of digits of N.

**Input**:
Enter the Number: 56
**Output:**
Sum= 11 // 5+6=11

import java.io.*; import java.util.*; import java.lang.*; public class temp { public static void main(String[] args) { int number,sum=0,rem; Scanner scan = new Scanner(System.in); System.out.println("Enter the Number: "); number = scan.nextInt(); while(number>0){ rem = ( number%10); sum += rem; number = number/10; } System.out.println("Sum= "+sum); } }

**INPUT_1:**

Enter the Number:

12345

**OUTPUT:**

Sum= 15

**INPUT_2:**

Enter the Number:

31203

**OUTPUT:**

Sum= 9

**INPUT_3:**

Enter the Number:

250

**OUTPUT:**

Sum= 7

**INPUT_4:**

Enter the Number:

4589

**OUTPUT:**

Sum= 26

**INPUT_5:**

Enter the Number:

666666

**OUTPUT:**

Sum= 36

**ILLUSTRATION – eXecuted using javac in linux terminal**

**Morae Q!**

- Convert from binary number to decimal number.
- Swap two numbers by using division and multiplication.
- Compute foot and inches into centimetres.
- Concatenate Strings.
- Convert lowercase letters to uppercase letters.
- Compute the sum of all the digits of N.
- Compute the area of the pentagon.
- Get input using scanner.
- Find the distance between two points (x1,y1) and (x2,y2).
- Finding patterns in a file using frep and egrep .
- Detecting a cycle in a directed graph using Depth First Traversal.
- Topological ordering in a Graph.
- Storing graphs using adjacency list.
- Introduction to graph theory.
- Graph Adjacency Matrix pseudo code.
- Adjacency Matrix for storing graphs.
- Dijkstra’s shortest path algorithm .
- Breadth first search (BFS) Algorithm.
- Find the multiple of given number in the list of integers.
- Finding patterns in files using grep .