Advertisement
Noam_15

Untitled

Feb 15th, 2017
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<time.h>
  4. void main()
  5. {
  6.     int num, x,z=4;
  7.     printf("Guess number between 0 and %d:   ",z);
  8.     scanf("%d",&num);
  9.     srand(time(0));
  10.     x = rand()%(z+1);
  11.     if (num==x)
  12.         printf ("Right!\n\n",num);
  13.     else
  14.         printf("Wrong!\n\n");
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement