Thread: how to do this question

  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    3

    Exclamation how to do this question

    how to write a programme that read an integer between 0 and 9999 and add all the digits in the integer. for example, if an integer is 8235, the sum of entire digit is 18.

  2. #2
    Registered User
    Join Date
    Jul 2011
    Posts
    3
    i almost crazy ald~~~~~~~~~~~

  3. #3
    Registered User
    Join Date
    Jul 2011
    Posts
    3
    i do hope somebody could help me

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    What have you tried?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Jul 2011
    Posts
    10
    for the adding of the numbers, I would say using a char array to hold each digit, and then adding them.
    C Strings in C and C++ - Cprogramming.com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 03-23-2011, 09:00 AM
  2. *szString = things question/memory question
    By Jang in forum C Programming
    Replies: 3
    Last Post: 01-20-2011, 04:59 AM
  3. Newbish Question file reading question....
    By kas2002 in forum C Programming
    Replies: 23
    Last Post: 05-17-2007, 12:06 PM
  4. Self regiserting DLLs question and libraries question.
    By ApocalypticTime in forum Windows Programming
    Replies: 2
    Last Post: 03-22-2003, 02:02 PM
  5. A question of color...(not a racial question)
    By Sebastiani in forum Windows Programming
    Replies: 7
    Last Post: 01-15-2003, 08:05 PM