Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Escreva um programa que solicite ao usuário para digitar seu nome completo e
- armazene em uma string. Em seguida conte quantas vogais existem nessa string.*/
- #include <stdio.h>
- #include <string.h>
- #define tam 100
- #include <conio.h>
- int main(){
- int i=0,j;
- char nome[tam];
- printf("\ninforme o seu nome:\n");
- fgets(nome,tam,stdin);
- fflush(stdin);
- for(j=0;j<tam;j++){
- switch (nome[j]) {
- case 'a' : i++;
- break;
- case 'e' : i++;
- break;
- case 'i' : i++;
- break;
- case 'o' : i++;
- break;
- case 'u' : i++;
- break;
- case 'A' : i++;
- break;
- case 'E' : i++;
- break;
- case 'I' : i++;
- break;
- case 'O' : i++;
- break;
- case 'U' : i++;
- break;
- }
- }
- printf("\nquantidade de vogais: %d",i);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement