1999 LSU Computer Science High School Programming Contest
Novice and Veteran Problem 1
How does ET count?

Many experts believe that humans settled on base ten (decimal) because we have ten fingers. The Searchers for Extra Terrestrials (SET) is convinced we that they will find life soon. They are also concerned that the life they discover will not have ten digits (and hence not use base ten). They have hired you to write a program to convert numbers in various bases to base ten.

Your input will be in the following format:

Valid bases are from base 2 to base 16.

If the values 10 through 15 are needed, you will use the letters "a" through "f" respectively. You will stop when you read in 0 for the base.

Example Input:

4 
123
8 
173
16 
12a3
16
ff
0

Your output should look like:

123 (4) is 27
173 (8) is 123
12a3 (16) is 4771
ff (16) is 255

NOTE: Do not worry about the formatting of numeric output (leading/trailing spaces around numbers are acceptable).



Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.


Clarifications:







Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.



The statements and opinions included in these pages are those of the LSU High School Programming Contest Staff only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.
© 1999 LSU High School Programming Contest

Return to the LSU High School Programming Contest Homepage