7 Replies  628 Views  Last Post: 18 February 2010  09:16 AM
#1 Guest_mga bogok*
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 5digit 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!
Replies To: find the numbers that will reverse when multiplied by 4
#2
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.
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.
#4 Guest_mga bogok*
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 5digit 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]
#5
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.
#6 Guest_mga bogok*
Re: find the numbers that will reverse when multiplied by 4
Posted 18 February 2010  09:00 AM
#7 Guest_mga bogok*
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']
You haven't implemented your rev function for starters.
can you please give me the full code so i can try it???
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???
#8
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.
Closed.
Page 1 of 1
