<mosaic.cnfolio.com>
PROGRAM
1. /*
2. START
3.
4. IF
5.   the number of cards is between 2 and 10
6. THEN
7.   Display the number of the cards
8. ELSE
9.   Display the number of cards is not right
10. END IF
11.
12. WHILE there are cards
13. IF
14.   the numbers on card are between 1 and 10
15. THEN
16.   Display the numbers on card
17.
18. END IF
19.
20.    Compare the numbers on the cards
21. IF
22.    The first number is lower than the second number
23. THEN
24.    swap the larger number with the lower number
25. ELSE
26.    keep numbers on the same spot
27. END IF
28.    Display the cards in desecending order
29.
30.
31.     Compare the first card of each player with the other player
32. IF
33.     Number on card for player one is higher than player two card
34. THEN
35.     Display player one wins
36. END IF
37. IF
38.     number on card for player one is lower than player two card
39. THEN
40.     Display player two wins
41. END IF
42. IF
43.     Number on card for player one is equal to player two card
44. THEN
45.     Display it is a draw
46. END IF
47.
48. END WHILE
49.
50. END
51. */
52.
53.
54.
55.
56. #include <stdio.h>
57.
58.   int main( void )
59. {
60.
61.         int array1;
62.         int array2;
63.         int i;
64.         int size1;
65.         int size2;
66.         int k;
67.         int swap;
68.         int m;
69.
70.       scanf("%d", &size1);
71.       if (size1 <=10 && size1>=2)
72. {
73.        {
74.          printf("size of the array is %d \n", size1 );
75.        }
76.            for (i=0; i<size1; i++)
77.            {
78.             scanf( "%d", &array1[i]);
79.             if (array1[i]<=10 && array1[i]>=1)
80.              {
81.              printf("%d ", array1[i]);
82.              }
83.            }
84.             for (k=0;k<(size1-1);k++)
85.      {
86.
87.             for(i=0;i<(size1-1);i++)
88.         {
89.             if (array1[i+1] < array1[i])
90.
91.             {
92.             swap = array1[i];
93.             array1[i] = array1[i + 1];
94.             array1[i + 1] = swap;
95.             }
96.
97.         }
98.
99.      }
100.
101.         printf("\ndesecending order: ");
102.         for (i=size1 ; i>0 ; i--)
103.         {
104.             if (array1[i-1]<=10 && array1[i-1]>=1)
105.             {
106.             printf ("%d ", array1[i-1]);
107.             }
108.         }
109.
110.
111.         scanf("%d", &size2);
112.       if (size2 <=10 && size2>=2)
113.        {
114.          printf("\n\nsize of array is %d\n", size2 );
115.        }
116.            for (i=0; i<size2; i++)
117.            {
118.             scanf( "%d", &array2[i]);
119.             if (array2[i]<=10 && array2[i]>=1)
120.              {
121.              printf("%d ", array2[i]);
122.              }
123.            }
124.             for (k=0;k<(size2-1);k++)
125.      {
126.
127.             for(i=0;i<(size2-1);i++)
128.         {
129.             if (array2[i+1] < array2[i])
130.
131.             {
132.             swap = array2[i];
133.             array2[i] = array2[i + 1];
134.             array2 [i+1] = swap;
135.             }
136.
137.         }
138.
139.      }
140.
141.         printf("\ndesecending order: ");
142.         for (i=size2; i>0 ; i--)
143.         {
144.       if(array2[i-1]<=10 && array2[i-1]>=1)
145.             {
146.             printf ("%d ", array2[i-1]);
147.             }
148.         }
149.
150.
151.
152.
153.      if (size1<=size2)
154.     {
155.     for ( m=0;m<size2;m++)
156.
157.        if( array1[m] != array2[m] )
158.
159.        {
160.        if( array1[m] > array2[m] )
161.        {
162.        printf ( "\n\n player one wins " );
163.        break;
164.        }
165.        else
166.        if( array1[m] < array2[m] )
167.        {
168.        printf ( "\n\n player two wins " );
169.        break;
170.        }
171.        }
172.        else
173.        if ( array1[m] == array2[m])
174.        {
175.        printf ( "\n\n it is a draw " )
176.
177.        }
178.
179.      }
180.      else
181.      if (size2<=size1)
182.     {
183.     for ( m=0;m<size1;m++)
184.         if( array1[m] != array2[m] )
185.
186.        {
187.        if( array1[m] > array2[m] )
188.        {
189.        printf ( "\n\n player one wins " );
190.        break;
191.        }
192.        else
193.        if( array1[m] < array2[m] )
194.        {
195.        printf ( "\n\n player two wins " );
196.        break;
197.        }
198.        }
199.        else
200.        if ( array1[m] == array2[m])
201.        {
202.        printf ( "\n\n it is a draw " )
203.
204.        }
205.
206.
207.      }
208. }
209.
210.
211.        else
212.        {
213.        printf ( " size is not right ");
214.        }
215. }