/* sum of digits */
#include<stdio.h>
#include<conio.h>
main()
{
	long int sum,n,a,b,c;
	clrscr();
	printf("Enter Number");
	scanf("%ld",&n);
	for(sum=0;n>0;)
	{
		a=n/10;
		b=a*10;
		c=n-b;
		sum=sum+c;
		n=a;
	}
	printf("The sum of digits=%ld",sum);
	getch();
}
/* input : 4567
   output: The sum of digits=22
*/