Now this is spam! I don't care if you have started a "homework service" but please don't post your add here.:)
Printable View
oops! i almost became an illegal intruder for your thread! sorry!
i should stay on topic! right?
Code:char buff[16];
int n = 12345;
int s = 0;
int i = 0;
sprintf(buff, "%d", n);
while (buff[i]) s += buff[i++] - '0';
printf("Number: %d\nSum of digits: %d\n", n, s);