Horje
How to generate a random array in c Code Example
How to generate a random array in c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

main(){
    int vet[1000], fre[50];
    int i;

    srand(time(NULL));

    for(i=0;i<1000;i++){
        vet[i]=(rand()%51);
    }

    for(i=0;i<1000;i++){
        printf("%d\n", vet[i]);
    }

    for(i=0;i<1000;i++){
        fre[vet[i]]=fre[vet[i]]+1;
    }

    for(i=0;i<51;i++){
        printf("The number %d  was generated %d times\n", i, fre[i]);
    }
}




C

Related
arduino client disconnect Code Example arduino client disconnect Code Example
linear gradient on text Code Example linear gradient on text Code Example
parcourir char c Code Example parcourir char c Code Example
how make a character in c scanf Code Example how make a character in c scanf Code Example
c iterate string Code Example c iterate string Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12