Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- int main()
- {
- int color;
- do
- {
- printf("\nEnter mode --> ");
- color = getchar();
- if (color == 10)
- continue;
- // clean buffer
- int c;
- while ((c = getchar()) != '\n' && c != EOF)
- {
- }
- } while (!isdigit(color) || (color != '1' && color != '0'));
- printf("\nCOLOR: %c\n", color);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement