In Out: Package Import Public Class Public Static Void Throws Int New New
In Out: Package Import Public Class Public Static Void Throws Int New New
package para_el;
import java.io.*;
public class examen {
public static void main(String[] args)throws Exception{
int a;
InputStreamReader isr = new InputStreamReader (System.in);
BufferedReader br = new BufferedReader (isr);
System.out.println("Ingrese primer digito: ");
a = Integer.parseInt(br.readLine());
if (a > 10){
System.out.println("El numero: " + a + " " + "Es mayor que DIEZ");
}else{
System.out.println("El numero: " + a + " " + "Es menor que DIEZ");
}
}
}
package para_el;
import java.io.*;
public class examen {
package para_el;
public class examen {
package para_el;
import java.io.*;
public class examen {
public static void main(String[] args)throws Exception{
int num, digSig;
InputStreamReader isr = new InputStreamReader (System.in);
BufferedReader br = new BufferedReader (isr);
System.out.println("Ingrese numero a invertir: ");
num = Integer.parseInt(br.readLine());
System.out.println("Numero en orden inverso: ");
do{
digSig = num % 10;
System.out.println(digSig);
num = num / 10;
}
while(num > 0);
}
}
PRACTICA CON ARRAYS UNIDIMENCIONAL
package para_el;
public class examen {
package para_el;
import java.io.*;
public class examen {
public static void main(String[] args)throws Exception{
int x;
float result = 0;
float arreglo[]= new float [10];
ARRAYS BIDIMENCIONAL
package para_el;
import java.io.*;
public class examen {
public static void main(String[] args)throws Exception{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
int matriz1 [][] = new int [4][3];
int matriz2 [][] = new int [4][3];
int result [][] = new int [4][3];
int fila,col;
for (fila = 0; fila < 4; fila++){
for (col = 0; col < 3; col++){
System.out.println ("Ingresar los datos de la matriz1
en la posicion" + fila + " , " + col);
matriz1 [fila][col] = Integer.parseInt(br.readLine());
}
}
for (fila = 0; fila < 4; fila++){
for (col = 0; col < 3; col++){
System.out.println ("Ingresar los datos de la matriz2
en la posicion" + fila + " , " + col);
matriz2 [fila][col] = Integer.parseInt(br.readLine());
}
}
for (fila = 0; fila < 4; fila++){
for (col = 0; col < 3; col++){
result [fila][col] = matriz1 [fila][col] - matriz2 [fila]
[col];
System.out.print (result [fila][col] + " ");
}
System.out.println (" ");
}
}
}
package para_el;
import java.io.*;
public class examen {
public static void main(String[] args)throws Exception{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
int matriz1 [][] = new int [4][3];
int matriz2 [][] = new int [4][3];
int result [][] = new int [4][3];
int fila,col;
for (fila = 0; fila < 4; fila++){
for (col = 0; col < 3; col++){
System.out.println ("Ingresar los datos de la matriz1
en la posicion" + fila + " , " + col);
matriz1 [fila][col] = Integer.parseInt(br.readLine());
}
}
for (fila = 0; fila < 4; fila++){
for (col = 0; col < 3; col++){
System.out.println ("Ingresar los datos de la matriz2
en la posicion" + fila + " , " + col);
matriz2 [fila][col] = Integer.parseInt(br.readLine());
}
}
for (fila = 0; fila < 4; fila++){
for (col = 0; col < 3; col++){
result [fila][col] = matriz1 [fila][col] * matriz2 [fila]
[col];
System.out.print (result [fila][col] + " ");
}
System.out.println (" ");
}
}
}