C Programming
Computer Programming

Program in c to reverse a given number



Write a Program in c to reverse a given number

\* C Program to to reverse a given number *\

# include < stdio.h >
int   main( )
{

int   num, rem, rev=0  ;
printf(" Enter the Number : ") ;
scanf("%d ", & num) ;
while (   num   > = 0 )
{

rem = num % 10  ;
rev = ( rev * 10 ) + rem  ;
num = num / 10  ;

}
printf("\n Reverse of Number is : ") ;
printf(" %d ",  rev) ;
return ( 0 ) ;

}

Output of Program:

Output of Program in C to reverse a given number