Skip to content

Instantly share code, notes, and snippets.

@NguyenTatNhac
Created December 16, 2022 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NguyenTatNhac/5a04f81f2ac25bdb57768fc516787121 to your computer and use it in GitHub Desktop.
Save NguyenTatNhac/5a04f81f2ac25bdb57768fc516787121 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int isConsonant(char ch)
{
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
{
if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U')
{
return 0;
}
else
{
return 1;
}
}
else
{
return 0;
}
}
void consonant(const char *s)
{
for (char c = *s; c; c = *++s)
{
if (isConsonant(c))
{
printf("%c", c);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment