As far as I can see in your prog the user only enters an integer. Heres an example I made where the user can enter a string, the first three characters are then converted to a number (0-9).
Code:
#include <stdio.h>
int main()
{
char temp[100]; //Temporary string for holding input
int col_1, col_2, resistor;
gets(temp);
col_1=temp[0]-48; //Digit for colour 1 equals the first character entered
col_2=temp[1]-48; //Colour 2 equals the second character
resistor=temp[2]-48; //minus 48 off ASCII value to get numeric value
printf("Colour 1: %i\nColour 2: %i\nResistor: %i", col_1, col_2, resistor);
getchar();
}
By getting input as a string the program is generally less likely to screw up on you and do bizzare things. That said if you had to extract the digits from an integer it could be done by a combination of dividing and modding. Example:
Code:
#include <stdio.h>
int main()
{
int input, col_1, col_2, resistor;
scanf("%i", &input);
col_1=input/100;
col_2=(input/10)%10;
resistor=input%10;
printf("Colour 1: %i\n Colour 2: %i\n Resistor: %i", col_1, col_2, resistor);
getchar();
getchar();
}
Hope this helps