Hope some one can help: I am new to programming and need to learn how to set up a range. Hope I am wording this right but, I am working on a project that requests user input(an integer) now after the input I would like to search a range of integers and if the user input is in that "range" conduct a "printf". If the integer is not in the range then conduct another "printf"...etc.
Example:
char X[]="Nebraska";
char XX[]="Texas";
char XXX[]="California";
char XXXX[]="Arkansas";
int ask;
range=(1-100) //This is that range I need//
int main()
{
scanf( "%i", &ask);
if ("%i", ask) = (1-25) //This is like the comparison I need to do//
printf("Nebraska\n");
if ("%i", ask) = (26-50) //" "//
printf("Texas\n");
if ("%i", ask) = (51-75) //" "//
printf("California\n");
if("%i", ask) = (76-100) //" "//
printf("Arkansas\n");
if ("%i", ask) > 100
printf("This is out of range\n");
return 0;
}
Sorry in advance if I didn't explain my problem correctly but, this should give
you an idea of what I am trying to accomplish. Plus I am 2 weeks into
C programming (Well trying to learn all I can off the internet at least).
~EvoTone~