MIPI_BaseC_WebinarFRTK/21_Seminar08/01_random_func_p4.c
2024-11-13 09:22:28 +03:00

23 lines
328 B
C

#include <stdio.h>
#include <stdlib.h>
enum {SIZE = 10, SEED = 123};
int random_number(int n)
{
return rand() % n;
}
int main(void)
{
int a[SIZE], i;
srand(SEED);
printf("Array:\n");
for (i = 0; i < SIZE; i++ )
{
a[i] = random_number(100) - 50;
printf("%4d", a[i]);
}
return 0;
}