Documente Academic
Documente Profesional
Documente Cultură
/*
*/
package ejercicio1;
import java.util.Scanner;
/**
*/
String nombre;
nombre = teclado.nextLine();
System.out.println(nombre.toUpperCase());
}
2.- Ingresar por teclado 1 nombre y un apellido. Mostrar en pantalla: Nombre
Apellido, ambos con la primer letra en mayúsculas independientemente de como
hayan sido ingresados No logré poner en mayúscula la primera letra.
/*
*/
package ejercicio2;
import java.util.Scanner;
/**
*/
//ingresados.
String nombre;
String apellido;
nombre = teclado.nextLine();
System.out.println(nombre);
apellido = teclado.nextLine();
System.out.println(apellido);
3.- Ingresar en las variables dia, mes y año una fecha. Mostrarla en pantalla con el
formato: dd-mm-aaaa
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ejercicio3;
import java.util.Scanner;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//Ingresar en las variables dia, mes y año una fecha.
//Mostrarla en pantalla con el formato: dd-mm-aaaa
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ejercicio4;
import java.util.Scanner;
/**
*
* @author nickipc
*/
public class Ejercicio4 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//4.- Ingresar un nombre. Mostrar en pantalla el nombre en mayúsculas y la cantidad
//de caracteres que tiene.
String nombre;
}
}
6.- Ingresar por teclado 1 número entero. Mostrar en pantalla su tabla de multiplicar
entre 1 y 12 (usando la instrucción for)
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ejercicio6;
import java.util.Scanner;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int tabla;
Scanner teclado=new Scanner (System.in);
System.out.print("Introduce un numero entero: ");
tabla = teclado.nextInt ();
for(int var1=1;var1<=12;var1++){
System.out.println(+tabla+"x"+var1+"="+(var1*tabla));
}
}
7.- Ingresar por teclado 1 número entero. Mostrar en pantalla su tabla de multiplicar
entre 1 y 12 (usando la instrucción while)
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ejercicio7;
import java.util.Scanner;
public class Ejercicio7 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//Ingresar por teclado 1 número entero. Mostrar en pantalla su tabla de multiplicar entre 1
//y 12 (usando la instrucción while)
while(i <=12){
System.out.println(num + " * " +i+ "=" + (num*i));
i++;
}
8.- Ingresar por teclado 1 número entero. Mostrar en pantalla su tabla de multiplicar
entre 1 y 12 (usando la instrucción do while)
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ejercicio8;
import java.util.Scanner;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//Ingresar por teclado 1 número entero. Mostrar en pantalla su tabla de multiplicar entre 1
//y 12 (usando la instrucción do while)
do{
System.out.println(num + " * " +i+ "=" + (num*i));
i++;
}
while(i <=12){
}