Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class HelloWorld
- {
- static void Main()
- {
- int cnt = 0, n = int.Parse(Console.ReadLine());
- double prev = int.Parse(Console.ReadLine());
- for (int i = 1; i < n; i++) {
- double now = int.Parse(Console.ReadLine());
- if ((now < 0) != (prev < 0) && (now != 0 && prev != 0))
- cnt++;
- prev = now;
- }
- Console.WriteLine("Число соседств двух чисел разного знака: " + cnt);
- Console.ReadKey();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement