#include<stdio.h>
#include<conio.h>
void
main()
{
int n,n1,r,s=0;
clrscr();
printf("Enter any number:-\n");
scanf("%d",&n);
n1=n;
do
{
r=n%10;
s=s+r;
n=n/10;
}while(n>0);
printf("The sum of a digit of %d is:-
%d",n1,s);
getch();
}
No comments:
Post a Comment