1. ## 90 ASCII representation?

I've looked at the ASCII table below:

http://www.lookuptables.com/

it doesn't seem to mention anything about a 90 representation of a char

so i tried the following:

Code:
```  char zero  = 48;
char ninty = 57+48; // prints out i.
char ninty2 = (char) 67; // prints out C ? :|```
but i can't seem to get an ASCII representation of 90 as a char.

2. Code:
```char num[] = "90";
printf("%s\n", num);```

3. Do you realize that "90" is 2 chars ?
Guess you want sth like this

Code:
```char ninety[3];
ninety[0]=57;
ninety[1]=48;
ninety[2]=0;
printf("%s", ninety );```
Kurt

4. is there anyway of storing as a char and not in an array?
what i want to do is check if a number entered is between 0 and 90.

Code:
```  char num[] = "90";
char num2[] = "0";
char numinput;

scanf("%c", &numinput);

while (numinput !=  num < num2)
{
printf("%s", "You entered a number greater than 90, please try again:");
scanf("%c", &numinput);

}```

5. what i want to do is check if a number entered is between 0 and 90.
So use a number:
Code:
```int num;

if (scanf("%d", &num) == 1 && num >= 0 && num <= 90)
printf("%d is valid\n", num);```

6. is there anyway to check if it's not valid i.e i tried the following:

if (scanf("%d", &num) == 1 && !num >= 0 && !num <= 90)
printf("%d is not valid\n", num);

but every everything i enter it just says it's not valid

7. If you want to reverse the logic you havee to use ||
Code:
```if (scanf("%d", &num) != 1 ||  num < 0 || num > 90)
printf("%d is not valid\n", num);```
Kurt

8. ! has higher precedence than >=, so !num will become either 0 or 1. since both 0 and 1 are always <= 90 and always >= 0, your if is always true. Try:
Code:
```if (scanf("%d", &num) != 1 || num < 0 || num > 90)
printf("%d is not valid\n", num);```

9. Read this for advice on getting a number from the user:
http://faq.cprogramming.com/cgi-bin/...&id=1043284385

You cannot use scanf() to reliably determine if the user entered a valid number or not.