Given a number, find sum of its digits.
Input : n = 687 Output : 21 Input : n = 12 Output : 3
How to compute in single line?
Please refer complete article on Program for Sum the digits of a given number for more details!
My Personal Notes arrow_drop_up
- Create Directory or Folder with C/C++ Program
- C Program to Swap two Numbers
- C Program for Bubble Sort on Linked List
- C program to invert (making negative) an image content in PGM format
- C Program for Selection Sort
- C Program for Bubble Sort
- C Program for Insertion Sort
- C Program for Radix Sort
- C/C++ Program for n-th Fibonacci number
- C Program for Counting Sort
- C Program for Binary Search (Recursive and Iterative)
- C Program for Min Cost Path
- C/C++ Program for Longest Increasing Subsequence
- C Program for Pancake sorting
- C Program for Binary Insertion Sort