-5
#include <stdio.h>

int main(){

    char c;

    while((c = getchar()) != EOF){
        if(c >= 'A' && c <= 'Z')
            c = c - 'A' + 'a';
        putchar(c);
    }

    return 0;
}

Came across this C code in MIT's Practical Programming in C. Can anyone explain how this program works?

nAiN
  • 55
  • 2
  • 7

1 Answers1

3

The program converts any input into lower case output.

You would have recognized this yourself, if you ran it, debugged it, or just made a paper test for this.

René Hoffmann
  • 2,766
  • 2
  • 20
  • 43