This seems like an easy program, ask the user to input two digits, then have the program display them in reverse. Yes I thought it was soooo easy too, but after user enters the two digits, my gcc compiler is getting hung up, I have to hit enter a bunch of times, then some key, and it finally shows the printf, ("the reversal is: ) BUT it doesn't show the reversal, it just put a 0 in front of the two digit number? Why? I thought it was an easy one, code looks logical to me. What did I miss?
Code:
#include <stdio.h>
main ()
{
/*this program allows a user to enter a 2 digit number and the output displays the reverse*/
int first_digit ;
int second_digit ;
printf ("Enter a two-digit number: ") ;
scanf ("%d%d", &first_digit, &second_digit) ;
printf ("The reversal is: %d%d\n", second_digit, first_digit) ;
return 0 ;
}