Skip to content

Instantly share code, notes, and snippets.

@jmramirezpro
Created February 18, 2016 11:49
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 jmramirezpro/74f265f5196d47edd455 to your computer and use it in GitHub Desktop.
Save jmramirezpro/74f265f5196d47edd455 to your computer and use it in GitHub Desktop.
/*
* CaracterVocal.c
* Escribe un programa que nos solicite una letra (mayúscula o minúscula)
y que muestre por salida estándar si es una vocal o una consonante.
* Creado el 16 de feb. de 2016
* Author: jmramirez
*/
#include <stdio.h>
#include <ctype.h>
int main(void)
{
char ch;
int comprobar;
printf("Introduce un catacter: ");
comprobar = scanf("%c",&ch);
if (comprobar < 1){
/* Error en la introdducción del caracter */
printf("Error en la introducción del caracter\n");
}else if (!isalpha(ch)){
printf("El caracter no es una letra\n");
}else if((ch == 'a') || (ch == 'e') || (ch == 'i') || (ch == 'o') || (ch == 'u')){
printf("El caracter %c es una VOCAL \n", ch);
}else{
printf("El caracter %c es una CONSONANTE \n", ch);
}
return (0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment