#include void readdec(int *, int *) ; int prnthex(int) ; int main(int argc, char *arvg[], char *envp[]) { int R0, R1, R2, R3 ; fputs("Enter a postive decimal number> ", stdout) ; /* Read in the integer as a decimal */ R2 = 0 ; while (1) { readdec(&R0, &R1) ; if (R0 < 0) break ; R2 = 10*R2 + R1 ; } fputs("\nIn hexadecimal your number is ", stdout) ; for (R3=4; R3>0; --R3) { R0 = R2 >> 12 ; /* Hard to do in the LC-2 */ R0 = prnthex(R0) ; putc(R0, stdout) ; R2 = R2<<4 ; } putc('\n', stdout) ; }