Advertisement
Emon766

Play Games

Nov 12th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.     //player 1 picks a number of x
  6.     int x;
  7.     scanf("%d",&x);
  8.     //player 2 guess the number of n
  9.     int n;
  10.     scanf("%d",&n);
  11.     int i;
  12.     int sum =0;
  13.     for(i=1; i<=n; i++)
  14.     {
  15.         int N;
  16.         scanf("%d",&N);
  17.         if(N==x)
  18.         {
  19.             printf("Right,Player-2 Wins!");
  20.             break;
  21.         }
  22.         else
  23.         {
  24.             int y;
  25.             y=n-i;
  26.             printf("wrong, %d Choice(s) Left!\n",y);
  27.  
  28.             if(y==0)
  29.             {
  30.                 printf("Player,1 Wins!");
  31.             }
  32.         }
  33.  
  34.     }
  35.  
  36.  
  37.  
  38. }
  39.  
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement