#include "stdafx.h"
#include <conio.h>
#include "stdlib.h"
#include "stdio.h"
#include "string.h"
int reverseInt(int num)
{
int rnum = 0;
printf("%d\n", num);
while(0 != num){
rnum = (rnum * 10) + (num % 10);
num = num / 10;
//printf("%d\n", num);
//printf("%d\n", rnum);
}
return (rnum = rnum + num);
}
int main()
{
int a = 12345;
int revnum = 0;
revnum = reverseInt(a);
printf("%d", revnum);
getch();
return 0;
}
Output:
54321
Related Post:
0 comments :
Post a Comment