Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- //Questão 4
- /* 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.*/
- int vogal,i;
- char nome[300];
- int main(){
- printf("Digite seu nome completo: ");
- gets(nome);
- if (strlen(nome)>300){
- printf("\nNome muito grande, tente novamente com um nome menor.");
- return 0;
- }
- for (i=0;i<strlen(nome);i++){
- if (tolower(nome[i])=='a')
- vogal++;
- if (tolower(nome[i])=='e')
- vogal++;
- if (tolower(nome[i])=='i')
- vogal++;
- if (tolower(nome[i])=='o')
- vogal++;
- if (tolower(nome[i])=='u')
- vogal++;}
- printf("\nQuantidade de vogais no seu nome: %d",vogal);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement