Added an example with a struct.
[C-Programming-Examples.git] / cbd_rand.c
blob6dde0899133a002aa56b4f465c600f3bf8e7f130
1 #include <stdio.h>
2 #include <stdlib.h>
4 int main(void)
6 int i, n, col;
8 printf("\n%s\n%s",
9 "Some randomly distributed integers. ",
10 "How many to print? ");
11 scanf("%d", &n);
12 printf("How many columns? ");
13 scanf("%d", &col);
15 for(i=0; i < n; ++i)
17 if(i % col == 0) { printf("\n"); }
18 printf("%d", rand()%10);
20 printf("\n");
22 return 0;