GTU PPS Program - 18
18. Write a program to reverse a number.
- #include<stdio.h>
- #include<conio.h>
- int main()
- {
- int num,rev=0,i,j;
- printf("\nEnter number : ");
- scanf("%d",&num);
- while(num!=0)
- {
- i=num%10;
- rev=rev*10+i;
- num/=10;
- }
- printf("\nReverse is %d",rev);
- getch();
- return 0;
- }
Comments