Commit 17867e4b by Silvia Barrientos

java

parents
public class Ejercicio01{
public static void main(String[] args) {
int valor1 = 12;
int valor2 = 5;
suma(valor1, valor2);
}
public static void suma(int val1, int val2){
int suma = val1 + val2;
System.out.printf("La suma de %d + %d es: %d\n", val1, val2, suma);
}
}
public class Ejercicio02 {
public static void main(String[] args) {
int valor1 = 1;
int valor2 = 1;
comparacion(valor1, valor2);
}
public static void comparacion(int val1, int val2){
if(val1 < val2) System.out.printf("\n%d < %d\n", val1, val2);
if(val1 > val2) System.out.printf("\n%d > %d\n", val1, val2);
if(val1 == val2) System.out.printf("\n%d == %d\n", val1, val2);
}
}
public class Ejercicio03 {
public static void main(String[] args) {
String nombre = "Silvia";
bienvenida(nombre);
}
public static void bienvenida(String nom){
System.out.printf("\nBienvenida %s \n", nom);
}
}
/*import java.util.Scanner;
public class Ejercicio04 {
public static void main(String[] args) {
String nombre;
Scanner entrada = new Scanner(System.in);
nombre = entrada.next();
bienvenida(nombre);
}
public static void bienvenida(String nom){
System.out.printf("\nBienvenida %s \n", nom);
}
}*/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment