ProgrammingHardTCS NQT · Infosys

What is printed?

What is printed?
#include <stdio.h>
int main(void) {
    printf("%c", 'Z' - 'A' + 'a');
}
  1. A. z
  2. B. {
  3. C. y
  4. D. a

Correct answer: A. z

'Z' - 'A' = 25, and 25 + 'a' = 122, which is the ASCII code for z.

More C Programming questions

Exams that ask this topic