K&R exercise opinion

Hi all, I'm reading K&R. There's an exercise in it to copy input to output using getchar() and putchar(). I created my own version and would like your opinion on it. Is code like mine used in the real industry or it's fine just for educational purposes only? Thanks for your opinions.

#include <stdio.h>

int main(void)
{
  while (putchar(getchar()) != '\n') {
    ;
  }
  return 0;
}