Advertisement
bigman95sch

Additional task #2 (24.10.13)

Oct 24th, 2013
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <time.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4.  
  5. int main()
  6. {
  7.     int myNum, yourNum, count = 0;
  8.     srand(time(NULL));
  9.     myNum = rand() % 6;
  10.     do
  11.     {
  12.         count++;
  13.         scanf("%d",&yourNum);
  14.         if (yourNum == myNum)
  15.         {
  16.             printf("%d\nA:%d\n",myNum,count);
  17.             yourNum = -1;
  18.         }
  19.         if (yourNum > myNum)
  20.             printf(">\n");
  21.         else if ((yourNum < myNum) && (yourNum != -1))
  22.             printf("<\n");
  23.     } while (yourNum != -1);
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement