Number position
-
The number to be encoded is 173946. Starting from the right side of the number (the units position), collect all of the odd position digits (i.e. digit 1, digit 3, digit 5, etc.) and create a new number leaving the digits in their left to right order. The new number would be 796.
-
The number to be encoded is 173946. Starting from the right side of the number (the units position), collect all of the odd position digits (i.e. digit 1, digit 3, digit 5, etc.) and create a new number leaving the digits in their left to right order. The new number would be 796.
-
The number to be encoded is 173946. Starting from the right side of the number (the units position), collect all of the odd position digits (i.e. digit 1, digit 3, digit 5, etc.) and create a new number leaving the digits in their left to right order. The new number would be 796.
Well let see .... I think you can start with a
for
orforeach
loop. And then you can move on to Google to get some more information. Logic makes the world go around .... Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's :bob: :)Programm3r My Blog: ^_^
-
:laugh: And you're in trouble if you need help with this homework question. Serious trouble.
Semicolons: The number one seller of ostomy bags world wide. - dan neely
-
The number to be encoded is 173946. Starting from the right side of the number (the units position), collect all of the odd position digits (i.e. digit 1, digit 3, digit 5, etc.) and create a new number leaving the digits in their left to right order. The new number would be 796.
The problem is well defined, hence: good luck! :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
The number to be encoded is 173946. Starting from the right side of the number (the units position), collect all of the odd position digits (i.e. digit 1, digit 3, digit 5, etc.) and create a new number leaving the digits in their left to right order. The new number would be 796.
-
Well let see .... I think you can start with a
for
orforeach
loop. And then you can move on to Google to get some more information. Logic makes the world go around .... Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's :bob: :)Programm3r My Blog: ^_^
I would go with a
while
loop:while not num.BON
{
etc.
}where
BON
is Beginning Of Number...:suss:Semicolons: The number one seller of ostomy bags world wide. - dan neely
-
I find it fun to take some simple homework assignment like this and try to turn it into a one-liner. ;)
int encode(int v){return 0<v?0xa*encode(v/0x64)+v%0xa:v-v;}
Despite everything, the person most likely to be fooling you next is yourself.
It would be SO awesome if he submits this....
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )