#include<stdio.h>
#include<conio.h>
void main()
{
int num, k=1, sum=0;
clrscr();
printf(“Enter the number whose digits are to be added:”);
scanf(“%d”,&num);
while(num!=0)
{
k=num%10;
sum=sum+k;
k=num/10;
num=k;
}
printf(“Sum of the digits:%d”,sum);
getch();
}
Free C programs with output, C++ (C plus plus), programs c programming language, object oriented programming, c programs codes, c program shortcuts, history of c programming language, c programming compilers
Sunday, May 8, 2011
Write a C program to find the sum of individual digits of a positive integer
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment