Respuesta :

tonb

Answer:

#include <math.h>

#include <stdio.h>

#include <string.h>

#define BASE 3

#define NRQUESTIONS 15

void toABC(int n, char* buf, int base, int size) {

   memset(buf, 'A', size);

   buf[size] = 0;

   while (n && size) {

       buf[--size] = 'A' + (n % base);

       n /= base;

   }    

}

int main()

{

   char buf[16];

   for (int i = 0; i < pow(BASE, NRQUESTIONS); i++) {

       toABC(i, buf, BASE, NRQUESTIONS);

       printf("%s\n", buf);

   }

}

Explanation:

Assuming 3 is the number of possible answers to choose from for each question.

I tackled this by having an integer counter enumerate all values from 0 to 3^15, and then convert each integer to a base-3 representation, using ABC in stead of 012.