Saturday, February 9, 2013

C Program To Find The Sum And Reverse Of A Number in c program

# include <stdio.h>
# include  <conio.h>
main()
{
 int num,tempsum;
 int sum=0;
 int reverse=0;
clrscr();
printf("Enter 5 digit no");
scanf("%d",&n);
while(num>0)
{
tempsum= num%10;
sum+=tempsum;
reverse=reverse*10+tempsum;
num=num/10;
}
printf("The sum of the digits is :%d",sum);
printf("the reverse of the no is %d",reverse);
getch();
}

No comments:

Post a Comment