## Description

**Stack to print numbers in other bases Java Program**

A stack can be used to print numbers in other bases (multibase output).

Example:

(Base8) 2810 = 3 * 81Â + 4 * 80 = 348

(Base4) 7210 = 1 * 43 + 0 * 42 + 2 * 41 + 0 * 4 = 10204

(Base2) 5310 = 1 * 25 + 1*24 + 0 * 23 + 1 * 22 + 0 * 21 + 1 * 20 = 1101012

Write a Java program using stacks (linked lists) that takes 3 non-negative (base 10) long integer numbers and a base B (B is in the range 2-9) and writes the number to the screen as a base B number. The program prompts the user for 3 numbers and bases, and then outputs them.

Use as input:

7210 Base 4

5310 Base 2

355310 Base 8

## Reviews

There are no reviews yet.