Friday, 24 July 2015

C Program - To sum of digits of given number

C Program to sum of digits of given number 



#include<stdio.h>
#include<conio.h>
void main()
{
int rem,temp,n,sum=0;
clrscr();
printf("\nEnter any number :- ");
scanf("%d",&n);
temp=n;
while(temp!=0)
{
rem=temp%10;
sum=sum+rem;
temp=temp/10;
}
printf("\nThe Reverse number is :- %d",sum);
getch();
}

Output:-



Back to 'C Language Programs'


No comments:

Post a Comment