mardi 25 août 2015

How does this code generate 100 random number

will this work just as well for(a=0;a<100;a++)?? Why would someone write code like the code below? I think I know how this code is read. Does it take for loop a * b? What other ways could you write this code? I have not seen any code similar on this site so I thought I would create a question for it. Please help me if you can, also I am new to this site.

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

int main() {
    int r,a,b;

    printf("100 Random Numbers: ");

    for (a=0; a<20; a++) {
        for (b=0; b<5; b++) {
            r=rand();
            printf("%d\t", r);
        }
    }
}




Aucun commentaire:

Enregistrer un commentaire