HTMLify

CHECK PANGRAM BY C
Views: 101 | Author: sunny_jain
//WRITE  a program to check if string is pangram?
// input-"the quick brown fox jumps over the lazy dog"
//output- is a pangram
//explanation- contains all the character from "a to z"
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
bool checkpangram(char str[])
{bool mark[26];
for (int i = 0; i < 26; i++)
mark[i] = false;
int index;
size_t size = strlen(str);
for (int i = 0; i < size; i++) {
    if('A' <= str[i] && str[i] <='z')
    index = str[i] -'a';
    else if ('a' <= str[i] && str[i] <= 'z')
    index = str[i] - 'a';
    else
    continue;
    mark [index] = true;
}
for(int i = 0; i<= 25; i++)
if(mark[i] == false)
return(false);
return(true);
}
int main()
{
    char str[]="the quick brown fox jumps over the lazy dog \n";
    if (checkpangram(str) == true)
    printf(" %s is a pangram", str);
    else
    printf(" %s is not a pangram", str);
    return 0;
}

Comments