ends with 'abb'

 #include<stdio.h>


#include<string.h>

void endswithABB(char *str)

{

    int l=strlen(str);

    if(l>=3&&str[l-3]=='a'&&str[l-2]=='b'&&str[l-1]=='b')

    {

        printf("ends with abb");

    }

    else

    {

        printf("not ends with abb");

    }

}


int main()

{

    char str[10];

    printf("Enter string: ");

    scanf("%s",str);

    endswithABB(str);

}

Comments