1. maxorator: I would do something like this but we haven't learned any of this.
jafet : We have not learned anything about arrays either.

So I am not sure what to do next. Have gotten some helpful hints but nothing that makes me change my mind on what to do. If you have any other suggestions please let me know. Thanks!

2. Which of these havent you learned: switch, for, fgets, printf, arrays?

3. fgets and arrays are the two that I have not learned yet.

4. guys, arrays havent been discussed yet, but still all your suggestions involve arrays. LOL.

zac_haryy , try this. this isnt the best solution but i think it works. I had this problem in my exam last year. here's how i solved it (without arrays);

Code:
```#include <stdio.h>
#include <conio.h>

int main(void) {
int input, num1=-1, num2=-1, num3=-1, num4=-1, num5=-1;
puts("Enter number:");
scanf("%d",&input);
num1=input%10;
input=input/10;
if(input!=0) {
num2=input%10;
input=input/10;
}
if(input!=0) {
num3=input%10;
input=input/10;
}
if(input!=0) {
num4=input%10;
input=input/10;
}
if(input!=0) {
num5=input%10;
input=input/10;
}
switch(num5) {
case 1: printf("one "); break;
case 2: printf("two "); break;
case 3: printf("three "); break;
case 4: printf("four "); break;
case 5: printf("five "); break;
case 6: printf("six "); break;
case 7: printf("seven "); break;
case 8: printf("eight "); break;
case 9: printf("nine "); break;
case 0: printf("zero "); break;
}
switch(num4) {
case 1: printf("one "); break;
case 2: printf("two "); break;
case 3: printf("three "); break;
case 4: printf("four "); break;
case 5: printf("five "); break;
case 6: printf("six "); break;
case 7: printf("seven "); break;
case 8: printf("eight "); break;
case 9: printf("nine "); break;
case 0: printf("zero "); break;
}
switch(num3) {
case 1: printf("one "); break;
case 2: printf("two "); break;
case 3: printf("three "); break;
case 4: printf("four "); break;
case 5: printf("five "); break;
case 6: printf("six "); break;
case 7: printf("seven "); break;
case 8: printf("eight "); break;
case 9: printf("nine "); break;
case 0: printf("zero "); break;
}
switch(num2) {
case 1: printf("one "); break;
case 2: printf("two "); break;
case 3: printf("three "); break;
case 4: printf("four "); break;
case 5: printf("five "); break;
case 6: printf("six "); break;
case 7: printf("seven "); break;
case 8: printf("eight "); break;
case 9: printf("nine "); break;
case 0: printf("zero "); break;
}
switch(num1) {
case 1: printf("one "); break;
case 2: printf("two "); break;
case 3: printf("three "); break;
case 4: printf("four "); break;
case 5: printf("five "); break;
case 6: printf("six "); break;
case 7: printf("seven "); break;
case 8: printf("eight "); break;
case 9: printf("nine "); break;
case 0: printf("zero "); break;
}
getch();
}```
i found a bug though, if you type in multiple zeros, it only prints out 1 zero. but hey, there's no such number as multiple zeros right?
and if you type in "0563", the zero isnt outputted. but i leave how to fix that up to you. 0563 isnt a legal number anyways.

5. Thanks for the help!! I am going to take a look at this tomorrow.

6. "You may assume the input is less than one million."

Then it's pruh-tty simple then, dah-lin. You divide X by 100,000. If the result is zero, then X is not larger than 100,000, so don't print anything. Otherwise print that digit. Then take X % 100,000, and repeat the process with 10,000, etc... until you reach 1.

Code:
```12,345 / 100,000 = 0 don't print
12,345 % 100,000 = 12,345
12,345 / 10,000 = 1 print "one"
12,345 % 10,000 = 2,345
2,345 / 1,000 = 2 print "two"
2,345 % 1,000 = 345
etc...```

7. Code:
```#include <stdio.h>

int main(void)
{
int input;

printf("Enter number : ");
scanf("%d",&input);

while ( mask > 0 )
{
if ( (input >= mask) || ( (input == 0) && (mask == 1) ) )
{
{
case 0: printf("zero "); break;
case 1: printf("one "); break;
case 2: printf("two "); break;
case 3: printf("three "); break;
case 4: printf("four "); break;
case 5: printf("five "); break;
case 6: printf("six "); break;
case 7: printf("seven "); break;
case 8: printf("eight "); break;
case 9: printf("nine "); break;
};

}
}
printf("\n");

/* Pause if you want */

return(0);
}```

8. hmmm, i thought that the data type int could only hold values from (-32,746) to (32,747)??? so im assuming the all beyond those values would be sifted out.

but then again, that's a different case if he's gonna use long. i just assumed int.

9. Try using a modern compiler.

Quzah.

10. ahh so in modern compilers, int isnt 4bytes big anymore? ok

11. 4 bytes = 32 bits (assuming 8-bits/byte)

32-bits unsigned range is 0 to +4294967295
32-bits signed range is -2147483648 to +2147483647

Perhaps you were thinking of the range of a (16-bit) short?

12. ahhh.. jeeze.. didnt know that.. last time i heard (from my instructor), int can only hold those aforementioned values. my my, how ancient am i.

13. Originally Posted by sangken
ahhh.. jeeze.. didnt know that.. last time i heard (from my instructor), int can only hold those aforementioned values. my my, how ancient am i.
Well, it depends really on what you mean by "can only hold..."

The standard defines INT_MIN and INT_MAX in limits.h, as:
Code:
```INT_MIN = -32767
INT_MAX = 32767```
However, more compilers use 32bit integers now, so the size the variable can use is much larger. But if you're trying to be portable with old compilers, don't assume anything past the above. Naturally you can test the size of the integer on your compiler. Or use long instead if you really require larger numbers.

In your teacher's case, I suspect they were used to teaching on some old piece of crap like Borland's old TC 3.0 or something, so that's the maximum you could actually fit in an int. Most schools (or their students that show up here anyway) seem stuck in the 16bit era.

Quzah.