Storing Random Numbers in 1D Array in Dev C++

//Program to store random values in 1D array.
#include<iostream>
#include<stdlib.h>
#include<time.h>
using namespace std;
int main()
{
int ar[20], i;
srand((unsigned)time(NULL));
for(i=0;i<10;i++)
{
ar[i]=rand()%100;
cout<<ar[i]<<"\t";
}
}



No comments

Post your comments

Powered by Blogger.