Advertisement
Guest User

Untitled

a guest
Nov 28th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <stdlib.h>
  4.  
  5. int main()
  6.  
  7. {
  8. int liczba, strzal=0, ileprob = 0;
  9.  
  10. srand(time(NULL));
  11. liczba = rand() % 100 +1;
  12.  
  13. while (strzal != liczba)
  14. {
  15. ileprob++;
  16. printf("Zgadnij liczbe z przedzialu 1-100. To Twoja %d proba.\n", ileprob);
  17. scanf_s("%d", &liczba);
  18. if (strzal < liczba)
  19. printf("To za malo!\n");
  20. else if(strzal > liczba)
  21. printf("To za duzo!\n");
  22. }
  23. printf("Udalo ci sie trafic za %d proba", ileprob);
  24. getchar();
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement