Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static double GetAverage()
- {
- int count = 0, sum = 0;
- int x = int.Parse(Console.ReadLine());
- while (x != -1)
- {
- count++;
- sum = sum + x;
- x = int.Parse(Console.ReadLine());
- }
- if (count < 100)
- return 0;
- return ((double)sum / count);
- }
- public static bool GoodDay(double[] a)
- {
- for (int i = 0; i < a.Length – 1 ; i++)
- if (a[i] > 8 && a[i + 1] > 8)
- return false;
- return true;
- }
- public static void Main()
- {
- double[] arr = new double[12];
- for (int i = 0; i < arr.Length; i++)
- {
- arr[i] = GetAverage();
- }
- if (GoodDay(arr) == true)
- Console.WriteLine("Good day");
- else
- Console.WriteLine("Not good day");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement