From b31a9b905df2957804a2f06a809b64247bfd72e0 Mon Sep 17 00:00:00 2001 From: Steven Schronk Date: Mon, 28 Dec 2009 22:42:56 -0600 Subject: [PATCH] Added cbd_rand. Generates x random numbers in y columns. Interactive program. --- cbd_rand.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 cbd_rand.c diff --git a/cbd_rand.c b/cbd_rand.c new file mode 100644 index 0000000..6dde089 --- /dev/null +++ b/cbd_rand.c @@ -0,0 +1,23 @@ +#include +#include + +int main(void) +{ + int i, n, col; + + printf("\n%s\n%s", + "Some randomly distributed integers. ", + "How many to print? "); + scanf("%d", &n); + printf("How many columns? "); + scanf("%d", &col); + + for(i=0; i < n; ++i) + { + if(i % col == 0) { printf("\n"); } + printf("%d", rand()%10); + } + printf("\n"); + + return 0; +} -- 2.11.4.GIT