Untitled
unknown
c_cpp
2 years ago
828 B
4
Indexable
#include <stdio.h> #include <stdlib.h> #include <windows.h> #include <time.h> // номер1 int main() { SetConsoleCP(1251); SetConsoleOutputCP(1251); srand(time(NULL)); const int size = 15; int arr[size]; int i; for (i = 0; i < size; i ++){ arr[i] = rand(); printf("d", arr[i]); } int kolnul = 0; int kolotr = 0; int sum = 0; for (i = 0; i < size; i++) if (arr[i] < 0) kolotr += 1; else if (arr[i] == 0) kolnul += 1; else sum += arr[i]; printf("сумма = %d", sum); printf("количество нулей = %d", kolnul); printf("количество отрицательных = %d", kolotr); return 0; }
Editor is loading...