I'm trying to print an array of 100 numbers in 10 rows and 10 columns, each number is randomly generated by a random number generator within a certain range. However, either nothing is printed or a single number is printed. How do I fix this?
I've looked at some examples of printing arrays but the code doesn't seem to work on my program. I've also looked at ways to seed random number generators with arrays however those as well don't seem to work.
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main()
{
int myRandomNumber, i, a;
srand(0);
myRandomNumber = rand();
double doubarr[10][10];
for (a = 0; a <100; a++);
for (i = 0; i<100; i++);
doubarr[i][a]=(double)(rand()%100+1)/2.0;
printf("%.2lf ", doubarr[i][a]);
}
I'd like the final results to print 10 rows and 10 columns of randomly generated numbers within the range specified in the code above. Thanks!
Aucun commentaire:
Enregistrer un commentaire