C - Write program to prompt for three characters

Requirements

Write a program that prompts for three characters. For example:

I'm waiting for three characters: 

Code three consecutive getchar() functions to read the characters.

Format the result like this:

The three characters are 'a', 'b', and 'c' 

where these characters - a, b, and c - would be replaced by the program's input.

Demo

#include <stdio.h>

int main()/*from   w w w .j  a va  2 s.c o  m*/
{
  int a, b, c;

  printf("I'm waiting for three characters: ");
  a = getchar();
  b = getchar();
  c = getchar();
  printf("The three characters are '%c', '%c', and '%c'\n", a, b, c);
  return(0);
}

Result

Related Exercise