#include "stdafx.h" #include "stdlib.h" #include "time.h" int _tmain(int argc, _TCHAR* argv[]) { int n, p = 1, typ; srand((unsigned) time(NULL)); for(int i = 0; i < 10; ++i) { rand(); } n = 1 + rand() % 1000; printf("Podaj jakas liczbe\n"); scanf("%i", &typ); while(typ != n) { if(typ > n) { printf("%i to za duzo. Podaj nowa liczbe\n", typ); } else if(typ < n) { printf("%i to za malo. Podaj nowa liczbe\n", typ); } scanf("%i", &typ); ++p; } printf("Gratulacje, trafiles :) Szukana liczba to %i. Prob %i\n", n, p); return 0; }