C Programming – HackerRank Solution | Pangram Checking 1 |

(HackerRank) Write a Modular C Programming code to solve Pangram Checking 1, Given a string check if it is Pangram or not. A pangram is a sentence containing every letter in the English Alphabet.

Given a string check if it is Pangram or not. A pangram is a sentence containing every letter in the English Alphabet.

Input Format

First Line contains a string

Constraints

1 ≤ |S| ≤ 10^4

Output Format

Output YES if the string is pangram else output NO

Sample Input 0

Bawdsjogflickquartzvexnymph

Sample Output 0

YES

Explanation 0

 In the given input, there are all the letters of the English alphabet. Hence, the output is YES

Refer : C Programming HackerRank all solutions for Loops | Arrays | strings

 

CODE:

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int main() {
    char str[100];
    scanf("%s",str);
    int n=strlen(str);
    if(n>=26)
    {
        int i,j,status;
    for(i=65;i<=90;i++)
    {
        status=0;
        for(j=0;j<n;j++)
        {
            str[j]=toupper(str[j]);
            if(str[j]==i)
                status=1;
        }
        if(status==0)
            break;     
    }
    if(status==1)
        printf("YES");
    else
        printf("NO");
}
else{
    printf("NO");
}
    return 0;
}

OUTPUT

Congratulations, you passed the sample test case.

Click the Submit Code button to run your code against all the test cases.

Input (stdin)

Bawdsjogflickquartzvexnymph
Your Output (stdout)

YES
Expected Output

YES

 

Please find some more codes of Loops, Condition Statements, 1D Arrays, 2D Arrays, Strings, Pointers, Data Structures, Files, Linked lists, MISC, Solved model question papers & Hacker Rank all solutions on the below page:

Top 100+ C Programming codes – KLE Technological University

Leave a Comment