#include #include #include int main(void) { int i = 0; int j; int k; int input; time_t t; int villspela; int ratt; int gissning; char yesno; villspela = 0; while (villspela == 0) { time(&t); srand(t); j = (int) ((pow(2, i)) * 100 + 1); k = rand() % j; ratt = 1; while (ratt == 0) { printf("so, whats your guess\n"); scanf("%d", &gissning); if (gissning == k) { printf("right on spot, nice\n"); printf("You guessed %d times\n", i); } else if (gissning > k) { printf("Smokin or what? You are to high\n"); printf("Guess again\n"); scanf("%d", &gissning); } else { printf("Got the blues? You are to low\n"); printf("Guess again\n"); scanf("%d", &gissning); } i++; printf("Play some more?\n, y\n"); scanf("%c", &yesno); if (yesno == 'y') { villspela = 0; } } } return (0); }