Page 1 of 1

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

• Born again Pastafarian.

Reputation: 618
• 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

• The programming dinosaur

Reputation: 545
• Posts: 1,420
• 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

Reputation:

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

Posted 18 February 2010 - 08:36 AM

mga 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

• Saucy!

Reputation: 6246
• Posts: 24,014
• 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

Reputation:

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

Posted 18 February 2010 - 09:00 AM

JackOfAllTrades, 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

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']

JackOfAllTrades, 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

• Saucy!

Reputation: 6246
• Posts: 24,014
• 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

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }