program to reverse a number entered



LIST OF PROGRAMS



#include<stdio.h>
#include<conio.h>
void main()
{
long int n,x=0,tmp=0;
 clrscr();
printf("Enter a number=\n");
scanf("%ld",&n);
do
{ x=n%10;
 tmp=(tmp*10)+x;
 n=n/10;
 }while(n>0);
printf("New number=  %ld",tmp);
getch();
}

LIST OF PROGRAMS


Comments

Anonymous said…
what is this tmp?
Anuj Batham said…
tmp is the variable name
you can use any variable name but it must follow the variable declaration rules