Hi i need to generate a random number (between 0 and 2) in an array[15][3]..the first column should be from 1 to 15 and thats k ive done that but the 2nd and 3rd column should generate a random number of 0 to 2 but its not working...ive done the following till now:
#include<stdio.h>     /* for printf */
#include<stdlib.h>   /* for rand*/

  void main(void)
  int t, i, num[15][3];

  for(t=0; t<15; ++t)
  for(i=0; i<3; ++i)
  num[t][0] = t+0+1;

  /* now print them out */
  for(t=0; t<15; ++t) {
    for(i=0; i<3; ++i)
    printf("%3d", num[t][0]);

help me plz...

Last edited by shabbir; 14Dec2007 at 09:07.. Reason: Code block