Sunday, September 2, 2012

Reverse Number Logic in C program

Reverse Number Logic in C program

This is program for reversing digit of given number by simple logic. Program use While loop for repetitive process.

/* Program For Reverse a Number*/
#include<stdio.h>
#include<math.h>

int main()
{
int no,rem;
printf("\nEnter no\n");
scanf("%d",&no);
int bs=no;
int sum=0;
while(no)
{
rem=no%10;
sum=sum*10+rem;
no=no/10;
}

printf("Reverse Of  %d is \t :%d\n",bs,sum);
return 0;


}



0 comments:

Post a Comment