Please help solve the problem. An array of integers is given. Determine how many times the sign changes in the longest sequence of numbers that does not contain zeros. C language. Thank you very much.
int main() { const int N = 10; int mas[N], i; setlocale(LC_ALL, "Rus"); for (i = 0; i < N; i++) { printf_s("\tmas[%d] = ", i); scanf_s("%d", &mas[i]); } printf_s("\t"); for (i = 0; i < N; i++) printf_s("%d ", mas[i]); printf_s("\n"); int count = 0; for (i = 0; i < N - 1; i++) if (mas[i] > 0 && mas[i + 1] < 0 || mas[i] < 0 && mas[i + 1] > 0) count++; printf_s("\t%d", count); _getch(); return 0; }
{}on the toolbar. - mymedia