Random Array Generator in C

 


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:



AJ Blogs

Hello everyone, My name Arth and I like to write about what I learn. Follow My Website - https://sites.google.com/view/aj-blogs/home

Post a Comment

Previous Post Next Post
Best Programming Books

Facebook

AJ Facebook
Checkout Our Facebook Page
AJ Blogs
Checkout Our Instagram Page