Campbell Ritchie wrote:Welcome to the Ranch
Unfortunately there isn't a straightforward centred option for printing to the console. I am afraid you are gong to have to count characters in your words and calculate the spacing. Let's imagine you have a nine‑letter word to centre in 20 keystrokes' wdth. Use one places for the left *, and that leaves 19. Subtract (9 + 1), the 1 being for the right *. That leaves 9; half of 9 is 4, so try printf:-Alternatively, create a StringBuilder object and append those spaces to it.
You will need to expand my code to get it to work.