#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>

int main(void) {
	char buffer[100];
	long num;
	bool error = false;
	
	do {
		if(error) printf("The number must be in the range 1 to 5.\n");
		fgets(buffer, sizeof(buffer), stdin);
		//scanf("%100s", buffer);
		num = strtol(buffer, NULL, 10);
		error = true;
	} while(num < 1 || num > 5);
	
	printf("chosen number: %ld", num);
	
	return 0;
}
