Skip to main content

Featured

functions in Python

C++ program to display numbers which get reversed after multiplying by 4

#include<iostream.h>
#include<conio.h>
long int revfun(long int a)
{
  long int r=0,rem;
  while(a>0)
  {
  rem=a%10;
  r=r*10+rem;
  a=a/10;
  }
  return r;
}
void main()
{
clrscr();
for(long int n=1;n<=99999;n++)
  {
   long int rev=revfun(n);
   if(rev==n*4)
   {
   cout<<n<<endl;
   }
  }
getch();
}

OUTPUT:

Comments

  1. Sir, when I am running this program on Turbo C++, it is only showing
    2178, not 21978. What might be the problem?

    ReplyDelete
  2. A home tutor is not just for giving tuition on subjects, though. He can also be a mentor to the student, guiding in developing time management and better study skills. This improves student's overall performance.tuition singapore

    ReplyDelete
  3. This data gathering work of the machine will also free the teacher from the burden of record-keeping and tedious tasks that currently distract from the real job of teaching and learning.Resume Making in India

    ReplyDelete

Post a Comment

Popular Posts