Please use r as the programming language
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
srand(time(NULL));
int i;
for(i = 0; i<5; i++)
printf("%d\t", rand()%10);
}
/* code to generate n random numbers with lower and upper
limits*/
#include<stdio.h>
#include<time.h>
int l,u;
int* randomn(int A[],int n);
void main()
{
int i,n,A[20];
int *arr;
printf("Enter how many random no you want to print :\n");
scanf("%d",&n);
printf("Enter lower and upper limit of random nimbers: \n");
scanf("%d%d",&l,&u);
arr=randomn(A,n);
printf("%d Random numbers: \n",n);
for(i=1;i<=n;i++)
printf("%d ",A[i]);
printf("\n");
}
int* randomn(int A[20],int n)
{
int i;
srand(time(0));
for(i=1;i<=n;i++)
A[i]=(rand()%(u-l+1))+l;
return A;
}
Get Answers For Free
Most questions answered within 1 hours.