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();
}
Hope you liked my posts, give comments if you have any doubts.. :)#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();
}
Categories:
c program
0 comments:
Post a Comment