Tuesday 24 December 2013

A five-digit number is entered through the keyboard. Write a program to obtain the reversed number and to determine whether the original and reversed numbers are equal or not. (c++ code)

#include<iostream>
using namespace std;
#include<conio.h>
int main()
{

  int a,b,c,d,e,f,g,i,j;



  printf("Enter the five digit number\n");

  cin>>a;

  b=a%10;

  c=a/10;

  d=c%10;

  e=c/10;

  f=e%10;

  g=e/10;

  i=g%10;

  j=g/10;
int x;
x=b*10000+d*1000+f*100+i*10+j;// to rearang digites
  cout<<"The reverse number is "<<x;

  cout<<"\nThe original and reverse number is not equal";

  getch();
   return 0;

  /*  Letuswithc:

       this page is designed to help you learn C or C++.
  Understandable C and C++ programming tutorials, compiler reviews, source code, tips and tricks. 
         */

}

No comments:

Post a Comment