Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. int n, rand, count = 0, count1 =0, count2 =0;
  2. Console.WriteLine("enter a full number n");
  3. n = int.Parse(Console.ReadLine());
  4. Random randNum = new Random();
  5. for (int i = 1; i <= n; i++)
  6. {
  7. rand = randNum.Next(8, 11);
  8.  
  9. if (rand == 8)
  10. {
  11. count++;
  12. }
  13. if (rand == 9)
  14. {
  15. count1++;
  16. }
  17. if (rand == 10)
  18. {
  19. count2++;
  20. }
  21. }
  22. if((count > count1) && (count > count2))
  23. {
  24. Console.WriteLine(8);
  25. }
  26. if((count1 > count) && (count1 > count2))
  27. {
  28. Console.WriteLine(9);
  29. }
  30. if((count2 > count1)&&(count2 >count))
  31. {
  32. Console.WriteLine(10);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement