Hello **Programmers/Coders,** Today we are going to share ** solutions of Programming problems of HackerRank of Programming Language C **. At Each Problem with Successful submission with

**all Test Cases Passed,**you will get an score or marks. And after solving maximum problems, you will be getting stars. This will highlight you profile to the recruiters.

In this post, you will find the solution for **Sum of Digits of a Five Digit Number in C-HackerRank Problem**. We are providing the **correct and tested solutions** of coding problems present on **HackerRank**. If you are not able to solve any problem, then you can take help from our Blog/website.

Use “Ctrl+F” To Find Any Questions Answer. & For Mobile User, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Option to Get Any Random Questions Answer.

**C **is one of the most widely used **Programming Languages**. it is basically used to build **Operating System**. **C **was developed by **Dennis Ritchie in 1972**. Below are some examples of **C Programming** which might you understanding the **basics of C Programming.**

**Read Also Articles**

- Computer Simulations Coursera Quiz Answers 2022 | All Weeks Assessment Answers [💯Correct Answer]
- Social Network Analysis Coursera Quiz Answers 2022 | All Weeks Assessment Answers [💯Correct Answer]
- Big Data, Artificial Intelligence, and Ethics Coursera Quiz Answers 2022 | All Weeks Assessment Answers [💯Correct Answer]

**Objective**

The modulo operator, `%`

, returns the remainder of a division. For example, `4 % 3 = 1`

and `12 % 10 = 2`

. The ordinary division operator, `/`

, returns a truncated integer value when performed on integers. For example, `5 / 3 = 1`

. To get the last digit of a number in base 10, use as the modulo divisor.

**Task**

Given a five digit integer, print the sum of its digits.

**Input Format**

The input contains a single five digit number, .

**Constraints**

**Output Format**

Print the sum of the digits of the five digit number.

**Sample Input 0**

10564

**Sample Output 0**

16

`Sum of Digits of a Five Digit Number in C – Hacker Rank Solution`

#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int n,last_num,sum = 0,temp; scanf("%d", &n); temp = n; while(temp > 0) { last_num = temp %10; sum = sum + last_num; temp = temp/10; } printf("%d",sum); return 0; }