Count lines written by several calls

A data logger runs the following C program. Assume every output call succeeds, output begins on an empty line, and no other output is written. How many complete output lines does it produce? Answer in lines, as an exact integer.


C
#include "stdio.h"

int main(void)
{
    printf("Logger: ");
    printf("ready\nChannel active\n");
    /* Announce the capture state. */
    printf("Capture enabled\nWaiting\n");
    return 0;
}

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Introduction to C Questions: