//code
#include<stdio.h>
main()
{
int n,sum=0;
printf("Enter no \n");
scanf("%d",&n);
while(n>0)
{
sum=sum+n%10;
n=n/10;
}
printf("Sum of no is=%d\n",sum);
}
#include<stdio.h>
main()
{
int n,sum=0;
printf("Enter no \n");
scanf("%d",&n);
while(n>0)
{
sum=sum+n%10;
n=n/10;
}
printf("Sum of no is=%d\n",sum);
}
No comments:
Post a Comment