Advertisement
ineedmorespacelx

Cadenas

Oct 30th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package cadenas;
  7. import java.util.Scanner;
  8. import java.io.IOException;
  9. /**
  10.  *
  11.  * @author JesseKislev
  12.  */
  13. public class Cadenas {
  14.  
  15.     /**
  16.      * @param args the command line arguments
  17.      */
  18.     public static void main(String[] args)throws IOException {
  19.        
  20.         Scanner leer = new Scanner(System.in);
  21.        
  22.         String x, y;
  23.         String w="123";
  24.        
  25.         System.out.println("Ingresa una cadena");
  26.         x = leer.nextLine();
  27.        
  28.         for(int x1=0; x1<x.length(); x1++){
  29.             char b = x.charAt(x1);
  30.             for(int z=0; z<w.length(); z++){
  31.                 char a = w.charAt(z);
  32.                 if(a==b){
  33.                     System.out.println(b);
  34.                 }
  35.             }
  36.         }
  37.        
  38.        
  39.     }
  40.    
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement