Pangram Programme

  c++, windows

I have written a pangram program code, but it is not showing the correct answer. Please tell me the error. When I ran the program, the problem arises when a is inputted at a place other than first, or maybe it shows true only when a is not at the first place.

#include<stdio.h>
#include<string.h>
int isPangram(char sentence[])
{
    for (int i='a';i<='z';i++)
    {
        int j=0;
        while(sentence[j]!='{$content}')
        {
            j++;  
            if(sentence[j]==i)
            {
                break;
            }
        }
        if(strlen(sentence)==j)
        {
            return 0;
            break;
        }
        else
        {
            return 1;
        }
    }
}

int main()
{
    char s[300];
    printf("Enter the string:");
    scanf("%[^n]s",&s);
    if(isPangram(s)==0)
    {
        printf("FALSE");
    }
    else if(isPangram(s)==1)
    {
        printf("TRUE");
    }
}

Source: Windows Questions

LEAVE A COMMENT