Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Dado um texto de entrada, verifique quantas vezes aparecem ocorrências da palavra ‘web’.
- #include<stdio.h>
- #define max 500
- int main()
- {
- char texto[max];
- int i,cont=0;
- printf("Digite o texto: ");
- gets(texto);
- for(i=0;texto[i]!='\0';i++)//verificando os caracteres
- if(texto[i]=='w' && texto[i+1]=='e' && texto[i+2]=='b')
- cont++;
- if(cont!=0)
- printf("Ocorre %d vezes a palabra web.",cont);
- else
- printf("Nao existe a palavra web no texto.");
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment