write a c program to find sum of digits in a given number.

#include<stdio.h>
#include<conio.h>
main()
{
  int x,n,sum=0;
  clrscr();
  printf("\n enter the number n");
  scanf("\n %d",&n);
  for(x=1;x<=n;x++)
{
  sum+=x;
  printf("\n x=%d,sum=%d",x,sum);
}
  return (0);
}