1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
koban [17]
3 years ago
12

Write a c program to print all possible marking schemes of 15 questions each with 3.

Computers and Technology
1 answer:
andrey2020 [161]3 years ago
3 0

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.

You might be interested in
Convert 311 from decimal to hexadecimal. Show your work.
Nataly [62]

Answer:

(311)₁₀ = (137)₁₆

Explanation:

To convert a base 10 or decimal number to base 16 or hexadecimal number we have to repeatedly divide the decimal number by 16 until  it becomes zero and write the remainders in the reverse direction of obtaining them.

311/16 = 19 remainder=7

19/16=1 remainder = 3

1/16 remainder = 1

Writing the remainder in the reverse direction that is (137)₁₆.

Hence the answer is 137.

7 0
3 years ago
The point at coordinates (2, -18) is in what direction from the origin?
Arada [10]
I wish i could give an answer but see in dont think straight
3 0
3 years ago
What is the value of the variable answer after the following code is executed?
Nitella [24]

Answer:

false

Explanation:

8 0
3 years ago
It is a life long skills like spelling, it is a skill of typing data currently and quickly using a computer keyboard
viva [34]
Is this a riddle bro?
6 0
3 years ago
True or False?If you live in a country that uses censorship,you may not be able to access certain websites.ONLY ANSWER IF UR 100
Fed [463]

Answer:

TRUE! can i get brainliiest?

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • Wi-Fi is all around us. Is there any downside to its pervasiveness?
    11·1 answer
  • This is the computer âchipâ that interprets computer instructions and processes data:
    13·1 answer
  • How to be cool idk who can awnser this but i know the cleetus can
    13·2 answers
  • Which is an example of synchronous communication? e-mail voicemail text message telephone conversation
    11·2 answers
  • For this scenario related to turtle drawing, indicate whether it is better to write a loop or a function (or a set of functions)
    13·1 answer
  • Match the image to the view type in a presentation program. scroll bar tool bar status bar menu bar provides an array of buttons
    10·2 answers
  • What command can you use if you accidentally delete a sentence in your document?
    13·2 answers
  • What is the best method for modern businesses to authorize the use of workplace resources to its employees? a. assign them a use
    9·1 answer
  • Which statement best describes the computers all around us?
    15·1 answer
  • How do I find unwanted programs on my computer?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!