as

C code posted
created at 30 Dec 00:04, updated at 12 Sep 20:13

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<stdio.h>
#include<stdlib.h>

int main()
{
     int a,b,c,d,e,f,g,h,i,j,k,l;
     printf("Enter a five digit number = ");
     scanf("%d",&a);
     b=a%10;
     c=a/10;
     d=c%10;
     e=c/10;
     f=e%10;
     g=e/10;
     h=g%10;
     i=g/10;
     j=i%10;
     k=i/10;
     l=b+d+f+h+j;
     printf("Sum of the digits = %d",l);
     printf("\n");
system("PAUSE");
return 0;
}
 
413 Bytes in 5 ms with coderay