<mosaic.cnfolio.com>
PROGRAM
1. #include <stdio.h>
2. #include <stdlib.h>
3. #include <time.h>
4. #include <string.h>
5.  int main()
6. {
7. double dollars1=0;
8. double dollars2=0;
9. double dollars3=0;
10. double totaldollarsearned=0;
11. double dollarsearned1=0;
12. double dollarsearned2=0;
13. double dollarsearned3=0;
14. double totaldollarslost=0;
15. double dollarslost1=0;
16. double dollarslost2=0;
17. double dollarslost3=0;
18. int bet1=0;
19. int bet2=0;
20. int bet3=0;
21. srand(time(NULL));
22. int r=rand()%40;
23. printf("The Grand Casino is now open\n next to each of your 3 bets please place the amount as well\n");
24. scanf("%d",&bet1);
25. scanf("%if",&dollars1);
26. scanf("%d",&bet2);
27. scanf("%if",&dollars2);
28. scanf("%d",&bet3);
29. scanf("%if",&dollars3);
30. if(bet1==00||bet2==00||bet3==00&&r==37);
31. {r=00;
32. }
33. printf("The choosen number is %d\n",r);
34. if(bet1==r)
35. {dollarsearned1=dollarsearned1+(dollars1*40);
36. printf("Congratulations your first bet has won!! %.2f\n",dollarsearned1);
37. dollarslost1=dollarsearned1-dollars1;
38. printf("Profit gained is %.2f \n",dollarslost1);
39. printf("Amount lost is %.2f\n",dollars1*-1);}
40. else
41. { printf("Your first bet has lost\n");
42. dollarsearned1=0;
43. printf("Profit gained is %.2f \n",dollarslost1);
44. printf("Amount lost is %.2f\n",dollars1*-1);
45. }
46. if(bet2==r)
47. {dollarsearned2=dollarsearned2+(dollars2*40);
48. printf("Congratulations your first bet has won!! %.2f\n",dollarsearned1);
49. dollarslost2=dollarsearned2-dollars2;
50. printf("Profit gained is %.2f \n",dollarslost2);
51. printf("Amount lost is %.2f\n",dollars2*-1);}
52. else
53. { printf("Your first bet has lost\n");
54. dollarsearned2=0;
55. printf("Profit gained is %.2f \n",dollarslost2);
56. printf("Amount lost is %.2f\n",dollars2*-1);
57. }
58. if(bet1==r)
59. {dollarsearned3=dollarsearned3+(dollars3*40);
60. printf("Congratulations your first bet has won!! %.2f\n",dollarsearned3);
61. dollarslost3=dollarsearned3-dollars3;
62. printf("Profit gained is %.2f \n",dollarslost3);
63. printf("Amount lost is %.2f\n",dollars3*-1);}
64. else
65. { printf("Your first bet has lost\n");
66. dollarsearned3=0;
67. printf("Profit gained is %.2f \n",dollarslost3);
68. printf("Amount lost is %.2f\n",dollars3*-1);
69. }
70.
71. totaldollarsearned=dollarsearned1+dollarsearned2+dollarsearned3;
72. totaldollarslost=totaldollarsearned-(dollars1+dollars2+dollars3);
73.
74. printf("the total profit and loss is %.2f\n",totaldollarslost);
75. if (totaldollarslost=-1*(dollars1+dollars2+dollars3))
76. { printf("looks like you lost it all");
77. }
78.
79. }