Untitled

mail@pastecode.io avatar
unknown
c_cpp
a year ago
655 B
0
Indexable
Never
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <time.h>

int main()
{
    SetConsoleCP(1251);
    SetConsoleOutputCP(1251);
    srand(time(NULL));
    const int size = 10;
    float arr[size];

    int i;
    for (i = 0; i < size; i ++){
        arr[i] = rand();
        printf("%4f", arr[i]);
    }

    int count = 0;
    for (i = 0; i < size; i++)
        if (arr[i] >= 1.5)
        count += 1;
    float sum = 0;
    for (i = 0; i < size; i++)
        if (arr[i] < 0)
        sum += arr[i];
    printf("сумма = %.2f", sum);
    printf("количесвто  = %d", count);
    return 0;


}