Advertisement
keviinrm7

Cuantas palabras contienen "ion"

Jun 7th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. Scanner teclado = new Scanner(System.in);
  2. int cont=0;
  3. for (int p=0;p<6 ;p++)
  4. {
  5.  
  6. System.out.println("Ingrese palabra");
  7. String palabra = teclado.next();
  8.  
  9. int indice= palabra.indexOf("ion");
  10.  
  11. if(indice !=-1){
  12. {
  13. cont = cont+1;
  14. }
  15.  
  16.  
  17.  
  18. }
  19.  
  20. }
  21.  
  22. System.out.println("Cantidad de palabras:"+ cont);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement