<mosaic.cnfolio.com>
PROGRAM
1. /*
2. input player1
3. input player2
4. let player1=values given
5. let player2=values given
6. if amount of values given to player1>10
8. if amount of values given to player2>10
10. if amount of values given to player1<2
12. if amount of values given to player2<2
14. if any player1 value>10
16. if any player2 value>10
18. player1 use desending bubble sort method
19. player2 use desending bubble sort method
20. show top card
21. if player1 and player2 have no cards left display "DRAW"
22. if player1 value>player2 value display "player1 is the WINNER!"
23. if player2 value>player1 value display "player2 is the WINNER!"
25. */
26.
27. #include<stdio.h>
28. int main()
29. {
30.      int player1[20], player2[20];
31.      int j,n,i;
32.      int tmp1, tmp2;
33.      int card1, card2
34.      scanf("%d",&n);
35.
36.      for(i=0;i<n;i++)
37.      {
38.            scanf("%d",&player1[i]);
39.      }
40.      for(i=0;i<n;i++)
41.      {
42.            printf("\t %d",player1[i]);
43.      }
44.      if ((n< 2) || (n>10))
45.      {
46.      printf ("Error, you need between 2 and 10 cards!");
47.      return 0;
48.      }
49.      if ((card11< 2) || (card1>10)){
50.
51.      printf ("INCORRECT CARD VALUE!");
52.
53.
54.      return 0;
55.      for(i=0;i<n;i++)
56.      {
57.            for(j=0;j<n-i;j++)
58.            {
59.                  if(player1[j]<player1[j+1])
60.                  {
61.                        tmp1=player1[j+1];
62.                        player1[j+1]=player1[j];
63.                        player1[j]=tmp1;
64.                  }
65.            }
66.      }
67.
68.      printf("\n\n Array in the Descending order is - \n");
69.      for(i=1;i<=n;i++)
70.      {
71.            printf("\t %d",player1[i]);
72.      }
73.      scanf("%d",&n);
74.      for(i=0;i<n;i++)
75.      {
76.            scanf("%d",&player2[i]);
77.      }
78.      for(i=0;i<n;i++)
79.      {
80.            printf("\t %d",player2[i]);
81.      }
82.      if ((n< 2) || (n>10)){
83.
84.      printf ("Error, you need between 2 and 10 cards!");
85.      return 0;
86.      if ((card1< 2) || (card1>10)){
87.
88.      printf ("INCORRECT CARD VALUE!");
89.      return 0;
90.        for(i=0;i<n;i++)
91.      {
92.            for(j=0;j<n-i;j++)
93.            {
94.                  if(player2[j]<player2[j+1])
95.                  {
96.                        tmp2=player2[j+1];
97.                        player2[j+1]=player2[j];
98.                        player2[j]=tmp2;
99.                  }
100.            }
101.      }
102.
103.      printf("\n\n Array in the Descending order is - \n");
104.      for(i=1;i<=n;i++)
105.      {
106.            printf("\t %d",player2[i]);
107.      }
108.
109.      for(i=0;i>10;i<10);i++;
110.      if (player1 == 0 && player2 == 0);
111.      {
112.      printf("Both hands are empty so, its a DRAW!");
113.      }
114.      if (player1[i]>player2[i])
115.      {
116.      printf("Player1 is the WINNER!");
117.      }
118.      if (player2[i]>player1[i])
119.      {printf("Player2 is the WINNER!")
120.      }
121.   return 0;
122. }