2074 6

CSC115 ยท 2074 ยท 5 marks

Write a program that computes the sum of digits of a given integer number.

Write a program that computes the sum of digits of a given integer number. [5]

C ProgrammingChapter 5: Control StatementDecision Making and Looping

To find the sum of digits of an integer, we repeatedly extract the last digit using the modulus operator (% 10), add it to a sum variable, and then remove the last digit using integer division (/ 10). This continues until the number becomes 0. Example: For n = 1234 - 1234 % 10 = 4, sum = 4, n = 1...