#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
int K;
int N;
int count=0;
printf("Input N\n");
scanf("%d", &N);
int array[N];
for (int i=0; i < N; i++) array[i] = rand();
printf("Input K\n");
scanf("%d", &K);
for (int i=0; i < N; i++){
printf("%d, ", array[i]);
if (K < array[i]) count++;
}
printf("\nNumber of items, greater than K is %d\n", count);
Объяснение:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
int K;
int N;
int count=0;
printf("Input N\n");
scanf("%d", &N);
int array[N];
for (int i=0; i < N; i++) array[i] = rand();
printf("Input K\n");
scanf("%d", &K);
for (int i=0; i < N; i++){
printf("%d, ", array[i]);
if (K < array[i]) count++;
}
printf("\nNumber of items, greater than K is %d\n", count);
}
Объяснение: