Find the first small letter in a given string

C program to find the first small letter in a given string.

Program

#include<stdio.h>
#include<conio.h>
#define MAX 50

void main()
{
	char str[MAX];
    int i, flag;

    printf("Enter the string\t:");
    gets(str);

    i = 0;
    flag = 0;
    while(str[i] != '\0')
    {
        if(str[i] >= 'a' && str[i] <= 'z')
        {
            printf("\nFirst small letter '%c' found at position %d",str[i],i+1);
            flag = 1;
            break;
        }
        i++;
    }
    if(flag == 0)
    {
        printf("\nSmall letter not found");
    }

    getch();
}

Output

Enter the string        :WELCOME to COURSECRUX.com

First small letter 't' found at position 9