Simvik

Print a number

Put a value into printed text with a placeholder. An easy embedded C problem (First steps in C), run and graded in the browser.

easy · First steps in C · printf · format

Inside the quotes of a printf, %d is a placeholder. It is replaced by the whole number given after the text.

Make show_reading print reading = followed by the value and a newline. For 25 the output is reading = 25.

Starter code

void show_reading(int value) {
  printf("reading = \n");
}

Example tests

A positive reading

show_reading(25);

Expected output:

reading = 25

A negative reading

show_reading(-3);

Expected output:

reading = -3

Learn it first

More First steps in C problems