See what questions your friends are asking today.

Program in c language to find the sum of digits?

Answer:
#include <stdio.h>
void main()
{
int digi,num,i,sum=0;


printf("Enter the number of digits:");
scanf("%d",&num);

while(i>0);
{
for(i=0;i<10000;i++)
{
digi=num;
i=digi%10;
sum=sum+i;
num=digi/10;
}
printf("The sum of digits entered is %d",sum);
}
}

Contributors

«
LanceRas
Trust: 68
  • Computer Programming Supervisor
»

Top Contributors This Week

  • Trust Points: 2703
  • Member Since: 3/09
  • Trust Points: 4830
  • Member Since: 1/12
  • Trust Points: 3818
  • Member Since: 5/09
  • Trust Points: 1577
  • Member Since: 11/09
  • Trust Points: 1047
  • Member Since: 11/08