Solution for Exercise 11-17

ex1117

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

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

    puts("100 Random Numbers");
    for(a=0;a<20;a++)
    {
        for(b=0;b<5;b++)
        {
            r=rand();
            printf("%d\t",r);
        }
        putchar('\n');
    }
    return(0);
}

Notes

* Some compilers come with a random() function that's "improved" over rand(). The random() function supposedly does the same thing as rand(), but it returns a long int value instead of an int.