Code:
#include <stdlib.h>
#include <stdio.h>
void main()
{
int i,n,m;
printf("Enter size of the array:");
scanf("%d",&n);
printf("Enter number upto which you want array to be:");
scanf("%d",&m);
int ran[n];
for(i=0;i<n;i++)
{
ran[i] = rand()%m;
printf("%d ",ran[i]);
}
}
Output:
Tags:
C Programs