#include<stdio.h>

/**
 * Terry Harvey CIS 105 Section 010 TA Tina Weymouth
 *
 *  Demonstration program to use a switch statement to print colors
 *  when given a number
 **/

int main(){

    int color = 0;
    int count = 5;

    /* Why does this code appear again later in the program? Does it
       need to? */

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

    /* This loop controls how many times the user is asked for a color
       number. */
    while (color != -1 && count > 0){

        count = count - 1;

        /* What numbers will get mapped to red by integer division? to green? */

        switch(color/4){

        case 0: printf("red\n"); break;
        case 2: printf("green\n"); break;
        case 1: printf("blue\n"); break;
        default: printf("purple\n"); 
        }

        printf("Enter a color number: ");
        scanf("%d", &color);
    }

    printf("goodbye!\n");

    return 0;

}


