# Thread: Help with the Programme (ARRAYS)

1. ## Help with the Programme (ARRAYS)

HELP PLEASE TO RESOLVE THE EXERCISE

Code:
```/*
Description: Extract Casual 100 Numbers .... but make a programme in which an already extracted Numer W'ont repeat.
*/

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>

int main (){

int N=100;
int num[N];
int i;

//inizio algortimo

srand((unsigned)time(NULL));
num[0]=1;
num[99]=100;

for(i=0;i<N;i++){

num[N]=rand()%(num[99]-num[0]+1)+num[0];    /*Formula for extracting Casual(random) Numbers with the biggest and smalletst value included */

printf("\n%d : %d",i,num[N]);
N++;
}

printf("\n\n\n");
//system("pause");
getch();
}```

im trying first to extract 100 random (Casual ) numbers .... extracted by PC ... but after extracted 7 numbers the programme .. gives me the error ... like in this picture -->

please help me to solve this problem .... and at last tell me how to do that the same number wont repeat in the extracted numbers ...

This is my first exercize with the Arrays ... and im not able to do it .. plz help

2. For a non repeating random numbers google "Fisher-Yates shuffle".

3. Code:
```         num[N]=rand()%(num[99]-num[0]+1)+num[0];    /*Formula for extracting Casual(random) Numbers with the biggest and smalletst value included */

printf("\n%d : %d",i,num[N]);```
Did you mean to use 'i' here instead of N?

4. ## No repeating ??

Originally Posted by bernt
Code:
```         num[N]=rand()%(num[99]-num[0]+1)+num[0];    /*Formula for extracting Casual(random) Numbers with the biggest and smalletst value included */

printf("\n%d : %d",i,num[N]);```
Did you mean to use 'i' here instead of N?

i have tried to remove N++;

and now it shows me 1<=Numbers<=100 ..... casual Numbers
but now what do i have to do for dont make it repeat the already extracted numbers ???
my actual programme is
Code:
```int main (){

int N=100;
int num[N];
int i;

//inizio algortimo

srand((unsigned)time(NULL));
num[0]=1;
num[99]=100;

for(i=0;i<N;i++){

num[N]=rand()%(num[99]-num[0]+1)+num[0];
printf("\n%d : %d",i,num[N]);
_sleep(100);
}

printf("\n\n\n");
//system("pause");
getch();
}```