Pangrams are words or sentences containing every letter of the alphabet at least once; the best known English example being A quick brown fox jumps over the lazy dog .
#include <stdio.h>
int main(void)
{
int index, i, pangram;
char ch, x[26] = {0};
printf("\n\n------------------------------------------\n");
printf("Enter a sentence to check if is a pangram\n");
printf("------------------------------------------\n");
printf("----------- Pangram Program --------------\n");
printf("Enter a pangram: ");
/* This While Loop checking if is a pangram or not. The program increment 1 for each that letter
you enter. So, if you have at least one and each letter is a pangram*/
while ((ch = getchar()) != '\n'){ // This time I dont used scanf, I used getchar
if('A'<=ch&&ch<='Z')// checking if Cap letter
index = ch-'A';
else if('a'<=ch&&ch<='z') // checking if isn't Cap letter
index = ch-'a';
else
continue;
x[index] = 1;// Here is stored all the letter with numbers.
}
pangram = 1;
// Basically this is loop that check if you have all letters.
for (i = 0; i < 26; ++i) {
if (x[i] == 0)
pangram = 0;
}
// If you have all letter, the array increment 1 and is a pangram
if (pangram == 1){
printf("------------------------------------------\n");
printf("Your sentence have all letter so is, Pangram\n");
printf("------------------------------------------\n");
printf(" By: <span class="wp-smiley wp-emoji wp-emoji-lol" title="XD">XD</span> Creations");
}
// If you dont have all letter, the array dont increment and isn't a pangram
else if(pangram == 0) {
printf("------------------------------------------\n");
printf("This sentence is not a Pangram\n");
printf("------------------------------------------\n");
printf(" By: <span class="wp-smiley wp-emoji wp-emoji-lol" title="XD">XD</span> Creations\n");
}
printf("\n\n");
system("PAUSE");// system("PAUSE"); is just for windows
return 0;
}