RosettaCodeData/Task/Pangram-checker/C/pangram-checker-2.c
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

23 lines
471 B
C

#include <stdio.h>
int pangram(const char *s)
{
int c, mask = (1 << 26) - 1;
while ((c = (*s++)) != '\0') /* 0x20 converts lowercase to upper */
if ((c &= ~0x20) <= 'Z' && c >= 'A')
mask &= ~(1 << (c - 'A'));
return !mask;
}
int main()
{
int i;
const char *s[] = { "The quick brown fox jumps over lazy dogs.",
"The five boxing wizards dump quickly.", };
for (i = 0; i < 2; i++)
printf("%s: %s\n", pangram(s[i]) ? "yes" : "no ", s[i]);
return 0;
}