Advertisement
joseleonweb

Untitled

Aug 30th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ParaulesSenars {
  4.  
  5.   public static void main (String[] args) {
  6.     Scanner lector = new Scanner(System.in);
  7.  
  8.     System.out.println("Escriu una frase de diverses paraules:");
  9.     String frase = lector.nextLine();
  10.  
  11.     String[] arrayParaules = frase.split(" ");
  12.     for(int i = 0; i < arrayParaules.length; i = i + 2) {
  13.       System.out.print (arrayParaules[i] + " ");
  14.     }
  15.   }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement