#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 tries;

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

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

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

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