Archive for the ‘CODE’ Category

C program to Print Inverse of a given Number

September 30, 2010

Inversing of a given Number. suppose we gave input 123456 then the output of the program will be 654321.

//C program to print inverse of a given number
#include<stdio.h>
#include<conio.h>
void main()
{
long int n,rn=0,d=0;
clrscr();
printf(“Enter the number\n\n”);
scanf(“%ld”,&n);
while(n>0)
{
d=n%10;
rn=rn*10+d;
n=n/10;
}
printf(“%ld”,rn);
getch();
}
(more…)