Hello Guys,
I am new in C Programming
I had wrote a code to reverse the number given by the user
but the problem is
When the user inputs number less than 10 it works fine
but just as the user inputs number like 134 or 351 nothing happens
help me what is the problem
here is the program
Please don't write your own new code , i want just to find the bug in the program
I am new in C Programming
I had wrote a code to reverse the number given by the user
but the problem is
When the user inputs number less than 10 it works fine
but just as the user inputs number like 134 or 351 nothing happens
help me what is the problem
here is the program
Code:
#include<stdio.h>
#include<conio.h>
main()
{
int num=0, revnum=0, temp=0;
printf("Program to reverse the number");
printf("\n\nEnter a Number ");
scanf("%d",&num);
if (num<=10)
printf("\nEnter Number Greater than 10\n");
else
{
while(num!=0)
{
temp=num%10;
revnum=revnum*10+temp;
num=num%10;
}
printf("Reversed Number=%d",revnum);
}
getch();
}
Please don't write your own new code , i want just to find the bug in the program