Write a C program that asks the user to enter an integer value, which may be either positive or negative. Then, the program will calculate sum of digits of the given integer.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter3: Assignment, Formatting, And Interactive Input
Section3.4: Program Input Using Cin
Problem 12E
icon
Related questions
Question
100%

Write a C program that asks the user to enter an integer value, which may be either positive or negative.

Then, the program will calculate sum of digits of the given integer.

Sample Program Run 1

Please enter an integer: 12653The sum of digits of 12653 is: 17


Sample Program Run 2

Please enter an integer: -8245

The sum of digits of -8245 is: 19

 

in c language

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Structure chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage