Ejercicio 2 Modelo B - 2016

package ejercicio2; import java.util.Scanner; package ejercicio2; import java.util.Scanner; public class Palabras { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); String word = null; int cont = 0; while (true) { System.out.print("Palabra: "); word = keyboard.nextLine(); if (word.equalsIgnoreCase("fin")) break; cont ++; } System.out.format("Total palabras: %d", cont); } }
La solución no es 100% completa, faltaría la implementarlo mediante la función total y pasar los parámetros por referencia.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.