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

void main()
{
	int myrand;
	int low = 1;					//lowest of range
	int high = 10;					//highest of range
	char choice;
	srand(time(NULL));				//seed randomness


	printf("Do you want to play JACKPOT? (y/n)");
	scanf(" %c", &choice);

	while (choice == 'y')
	{
		printf("\nOK...here we go...your lucky number is...");
		myrand = rand() % (high - low + 1) + low;	//get random number
		printf("%d", myrand);

		if (myrand == 5)
		{
			printf("\n\nWell done, that's the JACKPOT! You win a Christmas cake!\n\n");
		}
		else if (myrand >= 3 && myrand <= 7)
		{
			printf("\n\nNot quite the jackpot, but you still win a box of Tesco's mince pies!\n\n");
		}
		else
		{
			printf("\n\nSorry, you didn't win. Your stocking is empty this Christmas :(\n\n");
		}
		printf("Do you want to play JACKPOT? (y/n)");
		scanf(" %c", &choice);
	}
	printf("\nOK, maybe another time\n\n");
}
