vendredi 1 juillet 2016

Setting random in an Array

I want to generate an array of length 15 containing random numbers between 0 and 10. I want to prompt the user for a number in that range, and print out the number of times that number appears. I then want to print out the array with an asterisk(*) indicating each instance of that number in that array

Here is the code I am working on:

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

int main(){
    srand(time(NULL))
    int r=rand(0)%10
    int num; /*user's input*/
int r;
    printf("Input a number between 0 and 10. \n")
     for(num= ; num ; num++)
         printf("*")

return 0;

}




Aucun commentaire:

Enregistrer un commentaire