Question

Write a program that generates an array of one hundred random integers between 0 and 9...

  1. Write a program that generates an array of one hundred random integers between 0 and 9 and displays the count of each number. C programming
0 0
Add a comment Improve this question Transcribed image text
Answer #1
//Code.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
   int seedVal = 0;
   int arr[100] = {0}, i;
   srand(time((time_t*)&seedVal));
    for(i = 0;i<100;i++){
       arr[rand()%100]++;
   }
   
   printf("Number\tFrequency\n");
   printf("--------------------\n");
   for(i = 0;i<100;i++){
      printf("%d\t%d\n",i,arr[i]);
   }
   
   return 0;  
}  

   

Add a comment
Know the answer?
Add Answer to:
Write a program that generates an array of one hundred random integers between 0 and 9...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT