-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame Ans
55 lines (49 loc) · 801 Bytes
/
Game Ans
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include<stdio.h>
#include<conio.h>
#define M 6
#define N 4
void main()
{
int j,r[M],k,rk,counter,w;
clrscr();
rk = M;
k = 0;
w = 0;
j=0;
counter = 1;
while(j<M)
{
r[j]=j;
j++;
}
while(rk!=1)
{
if(k>=M)
{
k=0;
}
if (r[k]!=-1)
{
if(counter==N)
{
r[k]=-1;
printf("%d \t",k);
counter=1;
rk--;
k++;
}
else
{
w=k;
counter++;
k++;
}
}
else
{
k++;
}
}
printf("winner is %d",(w+1));
getch();
}