HTMLify
CHECK PANGRAM BY C
Views: 451 | Author: sunny_jain
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | //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; } |