1. Perhaps a while loop, (straight from my own Turbo C/C++ compiler )

Code:
```#include <stdio.h>

int main(void)   {

long number;
int sum, c;

/* get your number up here */

sum = 0;
while(number > 0)   {
sum += number &#37; 10;  /* same as sum = sum + number % 10 */
number /= 10;              /* same as number = number / 10 */
printf("\n  sum = %d, number = %ld ", sum, number);
}

printf("\n\n\t\t\t  Hit Enter When Ready ");
while((c = getchar()) != '\n');
c = getchar();

return 0;
}```

2. I have done it .. it was difficult to find out but i use Modulus and divide... and did it... i will post the code here.

3. Originally Posted by RahulDhanpat
Question
If a five Digit number is input through the keyboard , Write a programe to calculate the sum of its Digits?

Note:-Please when you write the code the explain it also, then only it will help me.And one more thing , I m using Turbo c++ Lite so please explain in easy terms.

insert
Code:
```#include<math.h>
main()
{int num,d1,d2,d3,d4,sum;
scanf ("%d",&num);
if (num>=1000 && num <=9999)
{d1=num%10;
d2=(num%100)/10;
d3=(num%1000)/100;
d4=(num%10000)/1000;  sum=d1+d2+d3+d4;
printf ("%d",sum);}}```
i've done it for 4digit num u can xtend it further easily

4. Originally Posted by rags_to_riches
Damn, flashbacks to Turbo Pascal from that screenshot!
Me too, I saw that and thought "Man that's familiar, I remember that IDE," and shivered in disgust.