It's doing exactly what you are telling it to. The line in the program:
Code:
printf ("You Entered the Number %d\n", number) ;
should probably be:
Code:
printf ("You Entered the Number ") ;
and should probably be placed before any of the other printf calls.
Okay, I'm back from last night folks!! Finally finished with this project. I stepped away from the programming for 14 hours to take a breather. Sometimes it's good just to step back and take some time away. Just came back to it 30 minutes ago, made some quick changes, and it's working! So happy!! Definitely couldn't have done it without all your help. I was having one problem with numbers like 20, 30, 40, 50, etc because there is no "new line, \n" in the first number cases because I didn't want the first word and second word to be on different lines, such as
forty-
five.
But then without the need for a second word (like 20, 30 etc), it was printing 40, as forty but with no new line character it was being pushed up against my next command line in terminal. So honestly, with a clear head, I thought about it for about 1 minute and decided to try to add a case 0 in the second number switch with the printf ("\n") ; AND IT WORKED!!! Yippee!!
Not to brag at all, because I'm not yet good at this, but that was purely an instinctive idea and I'm glad my mind is working!
Programming is so far one of the most challenging things I've done. It's like a very difficult puzzle or riddle, requires a lot of thought. It can be soooooo frustrating when one can't find the answer on his own and yet everybody else can whip it together in like 4 minutes. At the same time, because of the tremendous difficulty sometimes and the amount of time invested, it feels sooooo good when you finally get it right and it works, and your finished! So pardon the rambling, but after these marathon evenings, I'm on cloud 9 once I finally get it!!
Programming at this stage in my development makes macroeconomics and finance look easy
Thanks again everybody, now on to Chapter 6, loops/iteration statements. This should be fun!! See you all again when I get to the exercises at the back of the chapter, should give you all a few days rest !

Literally, you are all playing an important role in helping me to understand and learn this subject and I appreciate it very much. You folks are great with responding quickly and in a detailed manner, I couldn't ask for more. Although it's funny sometimes to see the thread take on a life of it's own well past my question being answered as everybody debates the subtleties and nuances of their interpretation of the C language. It's certainly a matter of style in my opinion as I've seen there are many ways to do the same thing. Here is the final working code if anybody's interested, thanks!
Code:
#include <stdio.h>
main ()
{
int first_number, second_number, number ;
printf ("Enter a two digit number: ") ;
scanf ("%d", &number) ;
printf ("You Entered the Number: ") ;
if (number == 11) {
printf ("eleven\n") ;
return 0 ;
}
else if (number == 12) {
printf ("twelve\n") ;
return 0 ;
}
else if (number == 13) {
printf ("thirteen\n") ;
return 0 ;
}
else if (number == 14) {
printf ("fourteen\n") ;
return 0 ;
}
else if (number == 15) {
printf ("fifteen\n") ;
return 0 ;
}
else if (number == 16) {
printf ("sixteen\n") ;
return 0 ;
}
else if (number == 17) {
printf ("seventeen\n") ;
return 0 ;
}
else if (number == 18) {
printf ("eighteen\n") ;
return 0 ;
}
else if (number == 19) {
printf ("nineteen\n") ;
return 0 ;
}
first_number = number / 10 ;
second_number = number % 10 ;
switch (first_number) {
case 9: printf ("ninety"); break;
case 8: printf ("eighty"); break;
case 7: printf ("seventy"); break;
case 6: printf ("sixty"); break;
case 5: printf ("fifty"); break;
case 4: printf ("forty"); break;
case 3: printf ("thirty"); break;
case 2: printf ("twenty"); break;
}
switch (second_number) {
case 9: printf ("-nine\n"); break;
case 8: printf ("-eight\n"); break;
case 7: printf ("-seven\n"); break;
case 6: printf ("-six\n"); break;
case 5: printf ("-five\n"); break;
case 4: printf ("-four\n"); break;
case 3: printf ("-three\n"); break;
case 2: printf ("-two\n"); break;
case 1: printf ("-one\n"); break;
case 0: printf ("\n"); break;
}
return 0 ;
}