Remove unused function prototypes
Code clean up and improvements

Replace while loops with for loops
Replace if else with ternary conditionals
More code cleanup

Replace printf with puts or putchar
when not formatting the output