win32 cosole application..help

how to make programm which give sum of digit of a given number in c++??????????e.number =123 sum of digits=6.
Try this:
1
2
3
4
    int n = 123;

    int digit = n % 10;
    n /= 10;


repeat lines 3 and 4 as many times as required, to get each digit in turn.
tell me whole programm
I gave you the key information. Try to write the program yourself based upon that idea, and if you still have problems, post your actual code here and we'll take a look.
Topic archived. No new replies allowed.