Saturday, August 20, 2011

Program to find the reverse of and sum of digits of the given number.

//Program to find the reverse of and sum of digits of the given number.
#include<stdio.h>
#include<conio.h>
void main()
{
 int num,sum=0,r,temp;
 long int n=0;
 clrscr();
 printf("\n\n Hi this program to find the reverse and sum of digits of the given number");
 printf("\n\n Please enter the one number: ");
 scanf("%d",&num);
 temp=num;
 while(num>0)
 {
  r=num%10;
  num=num/10;
  n=n*10+r;
  sum=sum+r;
 }
 printf("\n\n The reverse the given number %d is %ld and the sum of digits of the number is %d",temp,n,sum);
 getch();
}

Previous Next Home
0 Comments
Comments

Leave a Comment

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Twitter Delicious Facebook Favorites More