Program to find the reverse of the given number

0
50
#include<stdio.h>
#include<conio.h>
void main()
{
 long n;
 long s=0;
 clrscr();
 printf("\n Enter a number \n");
 scanf("%ld", &n);
 while(n!=0)
 {
   s=s*10+n%10;  /* n%10 gives last digit of the number n */
   n=n/10;       /* the number looses its last digit every time */
 }
 printf("\n reversed number = %ld", s);
getch();
}
  Output 1:
  Enter a number
  1203
  reversed number = 3021
  Output 2:
  Enter a number
  122300
  reversed number = 3221

 

 

Program to find the reverse of the given number Program to find the reverse of the given integer program to read an integer number and find the reverse of the given number Program to find the reverse of the given integer in cc Program to find the reverse of the given integer Write a Program to find the reverse of the given integer write a Program to find the reverse of the given integer in c program to find the reverse of the given number  Program to find the reverse of the given number in c Write a Program to find the reverse of the given number

LEAVE A REPLY

Please enter your comment!
Please enter your name here