Long back there was one question related to Lotto
http://cboard.cprogramming.com/showt...threadid=35508
Here is my code for that, can anybody optmize it further,
Code:main() { int i,k,j = 6; int a[6]; while ( getch() == 'C') { j = 6; while (j) { k = 6-j; i = (rand())%47; a[k] = i; while ( k-- ) { if ( a[k] == i ) { k = 6-j; i = (rand())% 47; a[k] = i; } } printf(" i = %d\t",i); j--; } printf("\n"); } }