#include <stdio.h>
#include <conio.h>
void main()
{
int a,b,c=0;
clrscr();
printf("\n Enter any number: ");
scanf("%d",&a);
while(a!=0)
{
b=a%10;
a=a/10;
c=b+c;
}
printf("sum of individual digits= %d",c);
printf("\n\n Thanks For Visiting");
printf("\n www.information-technology008.blogspot.in");
getch();
}
Input:
Enter any number: 567
Output:
sum of individual digits= 18
No comments:
Post a Comment