#include <stdio.h>

int char_lower(int c)
{
  if ((c >= 'A') && (c <= 'Z'))
    c = c + 'a' - 'A';
  return(c);
}

void string_lower(char s[])
{
  int n;
  n = 0;
  while (s[n] != 0)
  {
    s[n] = char_lower(s[n]);
    n++;
  }
}

void main(void)
{
  char s[100];
  int n;
  int c;
  int tries;

  printf("Welcome to LOWER.\n");

  tries = 0;
  while (tries < 5)
  {
    printf("Please enter a string:\n");

    n = 0;
    c = getchar();
    while (c != 'A')
    {
      s[n] =c;
      n++;
      c = getchar();
    }
    s[n] = 0;

    string_lower(s);
    printf("Here is the converted string:\n");
    printf(s);
    tries++;
  }
}
