Advertisement
weldisalves

Lista 04 - exercício 19

Jun 21st, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define MAX 100
  4.  
  5. //19. Exiba a quantidade de consoantes que compõe o nome do usuário.
  6.  
  7. int main()
  8. {
  9.     char nome[MAX];
  10.     int cont=0,i;
  11.  
  12.     printf("\n Digite um nome: ");
  13.     __fpurge(stdin);
  14.     fgets(nome,MAX,stdin);
  15.  
  16.     for(i=0;i<strlen(nome);i++)
  17.     {
  18.         if(!(nome[i]== 'A' || nome[i]== 'E' || nome[i]== 'I' || nome[i]== 'O' || nome[i]== 'U' || nome[i]== 'a' || nome[i]== 'e' || nome[i]== 'i' || nome[i]== 'o' || nome[i]== 'u' ||nome[i]=='\n'||nome[i]==' '))
  19.         {
  20.             cont++;
  21.         }
  22.     }
  23.     printf("\n Numero de consoantes: %d",cont);
  24.  
  25.     getchar();
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement