cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
win32 cosole application..help
win32 cosole application..help
Nov 3, 2013 at 2:17pm UTC
muddaser
(46)
how to make programm which give sum of digit of a given number in c++??????????e.number =123 sum of digits=6.
Nov 3, 2013 at 2:50pm UTC
Chervil
(7320)
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.
Nov 4, 2013 at 4:58am UTC
muddaser
(46)
tell me whole programm
Nov 4, 2013 at 11:10am UTC
Chervil
(7320)
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.