<mosaic.cnfolio.com>
PROGRAM
1. #include<stdio.h>
2.
3. /*
4. START
5.
6. Set the winnumber to 0
7. Set betnumbers to -1 for 4 times
8. Set bet to 0 for 4 times
9. Set total to 0
10. Set wronginput to 0
11. Set totalbet to 0
12.
13. Obtain 4 betnumbers and 4 bets
14. Initialise the random number generation to 0
15. Initialise the counter to 4
16.
17. While counter is less than 4
18. IF the betting number is between 0 to 37 and amount of money is more than 0
19. THEN
20. obtain a random number between 0 to 37
21. IF betting number is uquel to randon number
22. THEN
23. Display the number of bet
24. Display Amount of bet
25. Display winning number
26. Display the bet value  multiplied by 35 as profit
27. ELSE
28. Display the profit by subtracting the amount of bet from the bet
29. END IF
30. ELSE
31. Display an error massage
32. END IF
33. Do this 4 time add plus +1 to counter
34. END WHILE
35. Display an error massage
36. END
37. Display the total bet
38. Display the total profit
39. END
40.
41. */
42.
43. int main (void)
44.
45. {
46.
47. int winnumber=0;
48. int betnumber={-1,-1,-1,-1};
49. float bet={0,0,0,0};
50. float total=0;
51. float lossbet=0;
52. int wronginput=0;
53. float totalbet=0;
54. {
55.
56. scanf("%d %f %d %f %d %f %d %f", &betnumber, &bet, &betnumber,&bet,&betnumber,&bet,&betnumber,&bet );
57.
58. srand( time( 0 ) );
59.
60. int i=0;
61. while(i<4)
62. {
63.    if  ( ( betnumber[i] > -1 && betnumber[i] <38) && (bet[i]>0) )
64. {
65.    winnumber = rand() % 38;
66.
67.    printf("your number is %d \n", betnumber[i]);
68.    printf("you bet %g£ \n", bet[i]);
69.    printf( "%d is the winner number \n", winnumber );
70.
71. if(betnumber[i] == winnumber)
72. {
73.    printf("you won %g£ \n", bet[i] *35);
74.    total = total + (bet[i]*35);
75. }
76.
77.
78. else
79. {
80.    printf("you loss %g£ \n", bet[i]);
81.    lossbet = lossbet + bet[i];
82. }
83. }
84.
85.
86. else
87. {
88. printf(" Wrong input on bet %d \n", i+1);
89. wronginput=1;
90. break;
91. }
92. totalbet = totalbet + bet[i];
93. i++;
94. }
95.
96. if(wronginput == 0)
97. {
98. printf("your total bet is %g£ \n",totalbet);
99. printf("Your Profit is %g£ \n",total-lossbet);
100. }
101. }
102.
103.
104.
105. return(0);
106.
107.
108.
109.  }