Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int n, rand, count = 0, count1 = 0, count2 = 0;
- double avg;
- Console.WriteLine("enter a full number n");
- n = int.Parse(Console.ReadLine());
- Random randNum = new Random();
- for (int i = 1; i <= n; i++)
- {
- rand = randNum.Next(8, 11);
- if (rand == 8)
- count++;
- if (rand == 9)
- count1++;
- if (rand == 10)
- count2++;
- }
- if((count > count1) && (count > count2))
- Console.WriteLine("8");
- if((count1 > count) && (count1 > count2))
- Console.WriteLine("9");
- if((count2 > count1)&&(count2 >count))
- Console.WriteLine("10");
- avg = (count * 8 + count1 * 9 + count2 * 10) / n;
- Console.WriteLine(avg);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement