Write a program that will prompt a user for the size of an array and then create the array and using rand() populate the array with values and then print the array after the values have been populated in c

Respuesta :

Answer:

I'm assuming the array is of type float.

#include <stdio.h>

#include <stdlib.h>

int main(void)

{

int num;

printf("Enter the size of array: ");

scanf("%d", &num);

float arraydat[num];

for(int i = 0; i<num; i++)

{

arraydat[i] = scanf("%d", rand());

}

for(int i = 0; i<num; i++)

{

printf(" %d ", arraydat[i]);

}

return 0;

}

Explanation:

Otras preguntas