15
CADENAS MAYUSCULA, MINUSCULA Y POR PARTES package harry; public class Main { public static void main(String[] args) { String texto1="hola"; String textomay="TODOS LOS DIAS LA VEO EN L APANADERIA Y NI SIQUIERA LA HABLO== CARNICERO"; String texto2=new String("prueba"); System.out.println("La primera cadena de texto es: "); System.out.println(texto1); System.out.println("Concatenamos las dos: "+ texto1+" "+ texto2); System.out.println("Concatenamos varios: "+ texto1+" "+ 5 +" "+23.5); System.out.println(""); System.out.println("Las tres primeras letras del texto 2: "+ texto2.substring(0,3));// 1 pos y 2 cant System.out.println("La tres ultimas letras son: "+texto1.substring(1,4)); System.out.println("Y ahora es: "+ " "+texto1); System.out.println("texto2 en mayuscula: "+" "+texto2.toUpperCase());// mayuscula toLowerCase minuscula System.out.println("textomay : "+" "+textomay.toLowerCase()); } } LOS 10 NUMERO IMPARES SUMA Y PROMEDIO package javaapplication21; public class JavaApplication21 { public static void main(String[] args) { int impar[]; impar=new int[10]; int i,suma=0,prom=0; System.out.println("Los 10 numeros impares son: "); for(i=0;i<10;i++) { impar[i]=2*i; suma= suma +impar[i]+1; System.out.print(impar[i]+1+ " ");

Problemas de Vectores y Arreglos

Embed Size (px)

DESCRIPTION

PROBLEMAS DE VECTORES Y ARREGLOS

Citation preview

CADENAS MAYUSCULA, MINUSCULA Y POR PARTESpackage harry;public class Main {public static void main(String[] args) { String texto1="hola"; String textomay="TODOS LOS DIAS LA VEO EN L APANADERIA Y NI SIQUIERA LA HABLO== CARNICERO"; String texto2=new String("prueba"); System.out.println("La primera cadena de texto es: "); System.out.println(texto1); System.out.println("Concatenamos las dos: "+ texto1+" "+ texto2); System.out.println("Concatenamos varios: "+ texto1+" "+ 5 +" "+23.5); System.out.println(""); System.out.println("Las tres primeras letras del texto 2: "+ texto2.substring(0,3));// 1 pos y 2 cant System.out.println("La tres ultimas letras son: "+texto1.substring(1,4)); System.out.println("Y ahora es: "+ " "+texto1); System.out.println("texto2 en mayuscula: "+" "+texto2.toUpperCase());// mayuscula toLowerCase minuscula System.out.println("textomay : "+" "+textomay.toLowerCase()); }}LOS 10 NUMERO IMPARES SUMA Y PROMEDIO

package javaapplication21;public class JavaApplication21 {public static void main(String[] args) {int impar[];impar=new int[10];int i,suma=0,prom=0;System.out.println("Los 10 numeros impares son: ");for(i=0;i