JoseLargo

Untitled

Dec 6th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. package ejercicio8;
  2.  
  3. import java.util.Scanner;
  4. public class Ejercicio8 {
  5.  
  6.    
  7.     public static void main(String[] args) {
  8.        Scanner sc= new Scanner(System.in);
  9.        String cad, cadresul;
  10.        char num, let;
  11.        int i;
  12.        cadresul="";
  13.        i=0;
  14.        
  15.         System.out.println("Introduce la cadena de caracteres: ");
  16.         cad=sc.nextLine();
  17.         while(i<cad.length()){
  18.             num=cad.charAt(i);
  19.             let=cad.charAt(i+1);
  20.             i=i+2;
  21.             //Comparacion segun valores de tabla ascii '0'=48
  22.             while(num>'0'){
  23.                 num--;
  24.                 cadresul=cadresul+let;
  25.             }
  26.         }
  27.         System.out.println("La cadena resulante es: "+cadresul);
  28.     }
  29. }
Add Comment
Please, Sign In to add comment