SOLUTION: If you have 10 questions, and 2 choices per question, then I will have 2^10=1024 possible answer sheets. I would like to have a code in any programming language to generate for

Algebra ->  Permutations -> SOLUTION: If you have 10 questions, and 2 choices per question, then I will have 2^10=1024 possible answer sheets. I would like to have a code in any programming language to generate for       Log On


   



Question 1057864: If you have 10 questions, and 2 choices per question, then I will have 2^10=1024 possible answer sheets.
I would like to have a code in any programming language to generate for me these answer sheets up to the last one.
e.g answer sheet 1 can look like;
1.True
2.False
3.True
4.True
5.False
6.True
7.True
8.False
9.False
10.False

Answer by math_helper(2461) About Me  (Show Source):
You can put this solution on YOUR website!

C program:
#include

int main(int argc, char **argv)
{
int i,j;

for(i=0; i<1024; i++) {
// Print ans sheet corresponding to i
printf("Ans sheet %d\n", i+1);
for(j=0; j<10; j++) {
printf("%2d. ", j+1);
if ((i & (1< printf(" True\n");
}
else {
printf(" False\n");
}
}
}
return 0;
}