find the numbers that will reverse when multiplied by 4

i need the source code

Page 1 of 1

7 Replies - 507 Views - Last Post: 18 February 2010 - 09:16 AM Rate Topic: -----

#1 Guest_mga bogok*


Reputation:

find the numbers that will reverse when multiplied by 4

Posted 18 February 2010 - 08:20 AM

please provide me the source code for determining all the 5-digit numbers that will reverse when multiplied by 4. example 00000*4 = 00000 and 21978*4 = 87912... i only need to find the numbers. i need the source code. thanks! i already tried many times but the codes i used wont work... many have tried to help me without giving the code, but it was fruitless. maybe if you give me the source code, i will understand! thanks!
Is This A Good Question/Topic? 0

Replies To: find the numbers that will reverse when multiplied by 4

#2 Aphex19  Icon User is offline

  • Born again Pastafarian.
  • member icon

Reputation: 615
  • View blog
  • Posts: 1,873
  • Joined: 02-August 09

Re: find the numbers that will reverse when multiplied by 4

Posted 18 February 2010 - 08:26 AM

If you have tried then I think that you should show the efforts you have made. Then maybe we can try to point out where you might be going wrong and move on from their.

As for the problem, I wont write the program for you but why don't you write a loop that goes through every number and multiplies it by 4. Then you just check if the resulting number is the exact reverse of the original number. Not to hard really.
Was This Post Helpful? 0
  • +
  • -

#3 Martyn.Rae  Icon User is offline

  • The programming dinosaur
  • member icon

Reputation: 540
  • View blog
  • Posts: 1,406
  • Joined: 22-August 09

Re: find the numbers that will reverse when multiplied by 4

Posted 18 February 2010 - 08:27 AM

Please refer to this topic found here.
Was This Post Helpful? 0
  • +
  • -

#4 Guest_mga bogok*


Reputation:

Re: find the numbers that will reverse when multiplied by 4

Posted 18 February 2010 - 08:36 AM

View Postmga bogok, on 18 February 2010 - 07:20 AM, said:

please provide me the source code for determining all the 5-digit numbers that will reverse when multiplied by 4. example 00000*4 = 00000 and 21978*4 = 87912... i only need to find the numbers. i need the source code. thanks! i already tried many times but the codes i used wont work... many have tried to help me without giving the code, but it was fruitless. maybe if you give me the source code, i will understand! thanks!

#include <iostream>

int rev( int i )
{
    
}

int main()
{
    
    for( int i = 0; i < 99999; ++i )
    {
        if( rev(i) == i*4 ) cout << i << " * 4 = " << rev(i) << endl;
    }

    cout << "\nPress 'Enter' to continue ... " << flush;
    cin.get();
}





please tell me what is wrong with my code!

This post has been edited by JackOfAllTrades: 18 February 2010 - 08:57 AM
Reason for edit:: Added code tags. Please [code]...put your code in here...[/code]

Was This Post Helpful? 0

#5 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6078
  • View blog
  • Posts: 23,549
  • Joined: 23-August 08

Re: find the numbers that will reverse when multiplied by 4

Posted 18 February 2010 - 08:58 AM

Quote

please tell me what is wrong with my code!

You haven't implemented your rev function for starters.
Was This Post Helpful? 0
  • +
  • -

#6 Guest_mga bogok*


Reputation:

Re: find the numbers that will reverse when multiplied by 4

Posted 18 February 2010 - 09:00 AM

View PostJackOfAllTrades, on 18 February 2010 - 07:58 AM, said:

Quote

please tell me what is wrong with my code!

You haven't implemented your rev function for starters.

can you please specify my mistake???
Was This Post Helpful? 0

#7 Guest_mga bogok*


Reputation:

Re: find the numbers that will reverse when multiplied by 4

Posted 18 February 2010 - 09:02 AM

[quote name='mga bogok' date='18 February 2010 - 08:00 AM' timestamp='1266508821' post='930462']

View PostJackOfAllTrades, on 18 February 2010 - 07:58 AM, said:

Quote

please tell me what is wrong with my code!

You haven't implemented your rev function for starters.

can you please give me the full code so i can try it???
Was This Post Helpful? 0

#8 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6078
  • View blog
  • Posts: 23,549
  • Joined: 23-August 08

Re: find the numbers that will reverse when multiplied by 4

Posted 18 February 2010 - 09:16 AM

No, that's NOT how it works. We're NOT doing your homework for you!

Closed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1