codificacion de trabajos en neatbeens
TRANSCRIPT
1ª/* 1| * To change this template, choose Tools | Templates * and open the template in the editor. */package problema.nº2;import java.io.*;/** * * @author jair */public class ProblemaNº2 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { int n1,n2,s; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("numero 1:"); n1 = Integer.parseInt(in.readLine()); System.out.println("numero 2:"); n2 = Integer.parseInt(in.readLine()); s=n1+n2; System.out.println(""); System.out.println("suma: " +s); }}
2ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema3;import java.io.*;
/** * * @author jair */public class Problema3 {
/**
* @param args the command line arguments */ public static void main(String[] args)throws IOException { //varible int n1,n2,c,r; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("numero 1:"); n1 = Integer.parseInt(in.readLine()); System.out.println("numero 2:"); n2 = Integer.parseInt(in.readLine()); //proceso c=n1/n2; r=n1%n2; //salida System.out.println(""); System.out.println("cociente: " +c); System.out.println("residuo: " +r); // TODO code application logic here }}
3ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema.pkg4;import java.io.*;/** * * @author jair */public class Problema4 {
/** * @param args the command line arguments */ public static void main(String[] args)throws IOException { //variable float vv,igv,pv; //entrada BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("valor de venta:"); vv =Float.parseFloat(in.readLine());
//proceso igv = vv *0.18f; pv = vv+ igv; //salida System.out.println(""); System.out.println("igv: " +igv); System.out.println("precio de venta: " +pv); // TODO code application logic here }}
4ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema004;
import java.io.*;/** * * @author jair */public class Problema004 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { short a,n; int p; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("a: "); a=Short.parseShort(in.readLine()); System.out.println("n: "); n=Short.parseShort(in.readLine()); // TODO code application logic here p=(int)Math.pow((double)a, (double)n); System.out.println(""); System.out.println("Potencia: "+p); }}
5ª
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema04;
/** * * @author jair */public class Problema04 {
/** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here }}
6ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema05;import java.io.*;/** * * @author jair aguirre */public class PROBLEMA05 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { short n,r; int a; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("a: "); a=Integer.parseInt(in.readLine()); System.out.println("n: "); n=Short.parseShort(in.readLine()); // TODO code application logic here r=(short)Math.pow((double)a, (1/(double)n)); System.out.println(""); System.out.println("Radicación: "+r); // TODO code application logic here
}}
7ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema06;import java.io.*;/** * * @author jair */public class PROBLEMA06 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { // TODO code application logic here int n, ni, r; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("Número: "); n=Integer.parseInt(in.readLine()); r=n%10; n=n/10; ni=r*10; r=n%10; n=n/10; ni=(ni+r)*10; r=n%10; n=n/10; ni=(ni+r)*10; r=n%10; n=n/10; ni=(ni+r)*10; ni=ni+n; System.out.println(""); System.out.println("Inverso: " + ni); }}
8ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema8;import java.io.*;/** * *@author jair */public class Problema8 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { float c, r, t, i, m; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("Capital: "); c=Float.parseFloat(in.readLine()); System.out.println("Tasa de interes: "); r=Float.parseFloat(in.readLine()); System.out.println("Tiempo: "); t=Float.parseFloat(in.readLine()); m=(float)(Math.pow((double)(1+r/100),(double)t))*c; i=m-c; System.out.println(""); System.out.println("Interes: " + i); System.out.println("Monto: " + m); } } 9ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema9;import java.io.*;/** * * @author jair
*/public class Problema9 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { // TODO code application logic here //const float PI = 3.14159F; final float PI=3.14159f; float a,r; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("Radio: "); r=Float.parseFloat(in.readLine()); a=(float)(PI*(Math.pow((double)r, 2.0))); System.out.println(""); System.out.println("Ã�rea: "+a); }} 10ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema10;import java.io.*;/** * * @author jair */public class Problema10 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { final int HORA=3600; final int MINUTO=60; int t,h,m,s; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("Tiempo en segundos: "); t=Integer.parseInt(in.readLine());
h=t/HORA; //t=t%HORA; m=t/MINUTO; s=t; System.out.println(""); System.out.println("Horas: "+h); System.out.println("Minutos: "+m); System.out.println("Segundos: "+s); // TODO code application logic here }}
11ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema11;import java.io.*;/** * * @author jair */public class Problema11 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { int a,b,n1,n2; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("Número1: "); a=Integer.parseInt(in.readLine()); System.out.println("Número2: "); b=Integer.parseInt(in.readLine()); n1=a+b; n2=a-b; System.out.println(""); System.out.println("Suma: " + n1); System.out.println("Resta: " + n2); // TODO code application logic here }}
12ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema012;import java.io.*;/** * * @author jair */public class Problema012 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException{ int n; String r = ""; BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Número: "); n=(int)Integer.parseInt(in.readLine()); if (n>0) { r="POSITIVO"; } if (n<0) { r="NEGATIVO"; } if(n==0) { r="NEUTRO"; } System.out.println(""); System.out.println("Resultado: "+r);
}}
13ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema12;import java.io.*;/** *
* @author jair */public class Problema12 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { int a,b; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); a=Integer.parseInt(in.readLine()); b=Integer.parseInt(in.readLine()); String x = Integer.toString(a); String y = Integer.toString(b); System.out.println("el 1er número ingresado tiene: " + x.length() + " dÃgitos"); System.out.println("el 2do número ingresado tiene: " + y.length() + " dÃgitos"); // TODO co de application logic here }}
14ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema013;
import java.util.Scanner;/** * * @author jair */public class Problema013 {
/** * @param args the command line arguments */ public static void main(String[] args) {
char c;//String r="";System.out.println("Caracter");Scanner teclado=new Scanner(System.in);c=teclado.next().charAt(0);if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='A'||c=='E'||c=='I'||c=='O'||c=='U'){
//r="es vocal";}System.out.println("ES VOCAL");} else{//r="no es vocal"; }System.out.println("NO ES VOCAL");
}//System.out.println("la letra ingresada "+r);}}
15ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema13;import java.io.*;/** * * @author jair */public class Problema13 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { final int METRO=1000; final int DECIMETRO=100; final int CENTIMETRO=10; int mm,m,d,c; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("Cantidad de milÃmetros: "); mm=Integer.parseInt(in.readLine()); m=mm/METRO; d=mm/DECIMETRO; c=mm/CENTIMETRO; System.out.println(""); System.out.println("Metros: "+m); System.out.println("DecÃmetros: "+d); System.out.println("CentÃmetros: "+c); System.out.println("MilÃmetros: "+mm); // TODO code application logic here }}
16ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema014;import java.io.*;/** * * @author jair */public class Problema014 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { int n; String r; BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Numero: "); n=Integer.parseInt(in.readLine()); if(n%3==0 && n%5==0) { r="Sà ES MÚLTIPLO DE 3 Y 5";� }else { r="NO ES MÚLTIPLO DE 3 Y 5"; } System.out.println(""); System.out.println("Resultado:" + r); System.out.println(); }} 17ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema14;import java.io.*;/** * * @author jair */public class PROBLEMA14 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { double a, b, c, d, e; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("Ingresa un número, será el valor de a "); a=Integer.parseInt(in.readLine()); System.out.println("Ingresa un número, será el valor de b "); b=Integer.parseInt(in.readLine()); System.out.println("Ingresa un número, será el valor de c "); c=Integer.parseInt(in.readLine()); d=(4*(a*a*a*a)+(3*b*a)+(b*b))/(a*a-b*b); e=((3*(c*c))+a+b)/4; System.out.println(""); System.out.println("El resultado de la fórmula siguiente c=(4*a^4+3*b*a+b^2)/a^2-b^2, es: "+d); System.out.println("El resultado de la fórmula siguiente d=(3*c^2+a+b)/4, es: "+e); // TODO code application logic here }}
18ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema015;import java.io.*;/** * * @author jair */public class PROBLEMA015 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException{ // TODO code application logic here int n; String r; BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Número: "); n=Integer.parseInt(in.readLine()); if(n%2==0) { r= "PAR"; } else { r= "IMPAR"; } System.out.println(""); System.out.println("Resultado: " + r); System.out.println(); }}
19ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema15;import java.io.*;/** * * @author jair */public class Problema15 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { int a=1, b=2, c=3, d=4; int s=a+b+c+d;
double porcentaje_a=(double)(a*100)/s; double porcentaje_b=(double)(b*100)/s; double porcentaje_c=(double)(c*100)/s;double porcentaje_d=(double)(d*100)/s;
System.out.println(""); System.out.println("La variable \"a\" representa el: "+porcentaje_a+"% de "+s); System.out.println("La variable \"b\" representa el: "+porcentaje_b+"% de "+s); System.out.println("La variable \"c\" representa el: "+porcentaje_c+"% de "+s);
System.out.println("La variable \"d\" representa el: "+porcentaje_d+"% de "+s); // TODO code application logic here }}
20ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema016;import java.io.*;/** * * @author jair */public class PROBLEMA016 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException{ int n1,n2,n3,m; BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Número 1: "); n1= Integer.parseInt(in.readLine()); System.out.println("Número 2: "); n2=Integer.parseInt(in.readLine()); System.out.println("Número 3: "); n3= Integer.parseInt(in.readLine()); if (n1>n2) { if(n1>n3) { m=n1; } else { m=n3; } } else { if(n2>n3) { m=n2; } else
{ m=n3; } } System.out.println(""); System.out.println("Mayor: " +m); }}
21ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema16;import java.io.*;/** * * @author jair */public class Problema16 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { int lado =5; int perimetro; double area; perimetro= 5*4; area= Math.pow(lado,2); System.out.println(""); System.out.println("El perÃmetro del cuadrado de lado " +lado+" es "+perimetro+" y su área es "+area); // TODO code application logic here }}
// TODO code application logic here
22ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema017;import java.io.*;
/** * * @author jair */public class PROBLEMA017 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException{ int n,r; BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Número: "); n = Integer.parseInt(in.readLine()); if (!(n%2==0)) { r=n*2; } else { r=n*3; } System.out.println(""); System.out.println("Resultado: " + r); System.out.println(); }}
23ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema17;import java.io.*;/** * * @author jair */public class Problema17 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { final int SEGUNDOS=3600; final int MINUTOS=60; int h,m,s;
BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("Tiempo en horas: "); h=Integer.parseInt(in.readLine()); m=h*MINUTOS; s=h*SEGUNDOS; System.out.println(""); System.out.println("MINUTOS: "+m); System.out.println("SEGUNDOS: "+s); }}
24º/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema018;import java.io.*;/** * * @author jair */public class PROBLEMA018 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException{ int n1, n2, n3, mayor, inter, menor; BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Número 1: "); n1= Integer.parseInt(in.readLine()); System.out.println("Número 2: "); n2=Integer.parseInt(in.readLine()); System.out.println("Número 3: "); n3= Integer.parseInt(in.readLine()); if(n1 > n2 && n1 > n3) { mayor=n1; } else { if (n2 > n1 && n2> n3) { mayor=n2;
} else { mayor=n3; } } if(n1 < n2 && n1 < n3) { menor=n1; } else { if (n2 < n1 && n2 < n3) { menor=n2; } else { menor=n3; } } inter=(n1 + n2 + n3)- (mayor + menor); System.out.println(""); System.out.println("Mayor:" + mayor); System.out.println("Inter:" + inter); System.out.println("Menor:" + menor); System.out.println(); }}
25ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema18;import java.io.*;/** * * @author jair */public class Problema18 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { double f,k,c; BufferedReader in =new BufferedReader(new InputStreamReader(System.in));
System.out.println("Grados Fahrenheit: "); f=Integer.parseInt(in.readLine()); c = (f-32)/1.8; k = (f-32)*5/9+273.15; System.out.println(""); System.out.println("A grados Celsius: "+c); System.out.println("A grados Kelvin: "+k); }}
26ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema019;import java.io.*;/** * * @author jair */public class Problema019 {
/** * @param args the command line arguments */ public static void main(String[] args)throws IOException{ final float D1=0.1F; final float D2=0.2F; final float IGV=0.18F; float c,m_d, m_igv, p; BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Consumo: "); c=(float)Integer.parseInt(in.readLine()); if(c<=100) { m_d=c * D1; } else { m_d=c * D2; } m_igv=(c-m_d) * IGV; p= c - m_d + m_igv;
System.out.println("");System.out.println("Monto descuento: " + m_d);System.out.println("Impuesto IGV: " + m_igv);System.out.println("Importe a pagar: " + p);System.out.println(); }}
27ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema19;import java.io.*;import java.util.Scanner; /** * * @author jair */public class Problema19 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { Scanner ap = new Scanner (System.in); double a, b ,c;System.out.println("Área y perímetro de un Rectagulo");System.out.println("Ingrese el valor de a");a= ap.nextInt();System.out.println("ingrese el valor de b");b= ap.nextInt();double area= a*b;double perimetro=2*a+2*b;System.out.println("El Área de un rectángulo es = " + area);System.out.println("El Perímetro de un rectángulo es = " + perimetro);
}}
28/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema20;import java.io.*;/**
* * @author jair */public class Problema20 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { double s,c; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("Grados Sexagesimales: "); s=Integer.parseInt(in.readLine()); c=s*200/180; System.out.println(""); System.out.println("A grados Centesimales: "+c); }}
29ª
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema021;import java.io.*;/** * * @author jair */public class Problema021 {
/** * @param args the command line arguments */ public static void main(String[] args)throws IOException{ int t; String c; BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Temperatura: "); t = Integer.parseInt(in.readLine());
if (t<10) { c="FRIO"; } else { if (t>9 && t<21) { c="NUBLADO"; } else { if (t>=21 && t<=30) { c="CALOR"; } else { c="TROPICAL"; } } } System.out.println(""); System.out.println("Clima: " + c); System.out.println(); }}
30ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema21;import java.io.*;/** * * @author jair */public class Problema21 {
/** * @param args the command line arguments */ public static void main(String[] args)throws IOException { double s; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("incendiohohoohho");
31ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema022;import java.util.Scanner;
/** * * @author jair */public class Problema022 {
/** * @param args the command line arguments */ public static void main(String[] args){ Scanner in =new Scanner(System.in); final float DESC_G = 0.15F; final float DESC_A = 0.2F; final float REC_G = 0.1F; final float REC_A = 0.05F; //variables float mc, m, tp; //char tc,fp; String r ; String tc; String fp; System.out.println("Monto de compra: "); mc=in.nextFloat(); System.out.println("Tipo de cliente: "); tc =in.next(); System.out.println("Forma de pago: "); fp=in.next();
if(tc=="G") { if(fp=="C") { m = mc * DESC_G; tp = mc - m; r = "DESCUENTO 15%"; } else { m = mc * REC_G; tp = mc + m; r = "RECARGO 10%";
} } else { if (fp=="C") { m = mc * DESC_A; tp = mc - m; r = "DESCUENTO 20%"; } else { m= mc * REC_A; tp = mc + m; r = "RECARGO 5%"; } } System.out.println(""); System.out.println(r + ": "+m); System.out.println("Total a pagar: " + tp); System.out.println(); }}
31ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema22;
/** * * @author jair */public class Problema22 {
/** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here }}
32ª/* * To change this template, choose Tools | Templates * and open the template in the editor.
*/package problema023;import java.io.*;/** * * @author jair */public class PROBLEMA023 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException{ float a,b,x; BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("a: "); a=Float.parseFloat(in.readLine()); System.out.println("b: "); b=Float.parseFloat(in.readLine()); if(a!=0) { x=-b/a; } else { x=0; } System.out.println(""); System.out.println("x: " + x); System.out.println(); }}
33ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema024;import java.io.*;/** * * @author jair */public class Problema024 {
/** * @param args the command line arguments */ public static void main(String[] args)throws IOException { double a,b,c,d,x1,x2;
BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("a: "); a=(double) Integer.parseInt(in.readLine()); System.out.println("b: "); b=(double)Integer.parseInt(in.readLine()); System.out.println("c: "); c=(double) Integer.parseInt(in.readLine());
d = Math.pow(b,2)-4*c; if(a!=0 && d>=0) { x1 = (-b+Math.pow(d,(1.0/2)))/2*a; x2 = (-b-Math.pow(d,(1.0/2)))/2*a; } else { x1 = 0; x2 = 0; } System.out.println(""); System.out.println("x1: " + x1); System.out.println("x2: " + x2); System.out.println(); }}
34º/* * To change this template, choose Tools | Templates * and open the template in the editor. */package problema0025;import java.io.*;/** * * @author jair */public class Problema0025 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { int h,m,s; BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Hora: "); h= Integer.parseInt(in.readLine()); System.out.println("Minuto: "); m=Integer.parseInt(in.readLine()); System.out.println("Segundo: ");
s= Integer.parseInt(in.readLine());
s+=1; if (s==60) { s=0; m+=1; if(m==60) { m=0; h+=1; if(h==24) { h=0; } } } System.out.println(""); System.out.println("Hora: " + h); System.out.println("Minuto: " + m); System.out.println("Segundo: " + s); System.out.println(); }}
35ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package propuesto011;import java.io.*;/** * * @author jair */public class Propuesto011 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { int edad; BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); System.out.println("ingresa la edad de cualquier persona"); edad = Integer.parseInt(in.readLine()); if(edad>=18)
System.out.println("la persona es mayor de edad");
else
System.out.println("la persona es menor de edad"); }}
36ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package propuesto11;import java.io.*;/** * * @author jair */public class Propuesto11 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { int n1, n2, m = 0; BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Número 1: "); n1=(int) Integer.parseInt(in.readLine()); System.out.println("Número 2: "); n2=(int) Integer.parseInt(in.readLine()); if(n1>n2) m= n1; if(n2>n1) m= n2; System.out.println(""); System.out.println("Mayor:"+m); }}
37ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */
package propuesto012;import java.io.*;/** * * @author jair */public class Propuesto012 {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { int n1,n2,m; BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Número 1: "); n1= Integer.parseInt(in.readLine()); System.out.println("Número 2: "); n2=Integer.parseInt(in.readLine()); if (n1>n2) {
m=n2; } else { m=n1; }
System.out.println(""); System.out.println("Menor: "+m); }}
38ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package propuesto013;import java.io.*;/** * * @author jair */public class Propuesto013 {
/** * @param args the command line arguments
*/ public static void main(String[] args) throws IOException{ int a,b; BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Número 1: "); a= Integer.parseInt(in.readLine()); System.out.println("Número 2: "); b=Integer.parseInt(in.readLine()); if(a==b) System.out.println("números son iguales");
else
System.out.println("números son diferentes"); }}
39ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package propuesto014;import java.util.Scanner;/** * * @author jair */public class Propuesto014 {
/** * @param args the command line arguments */ public static void main(String[] args) { int a,b;
Scanner teclado=new Scanner(System.in); System.out.print("ESCRIBIR UN NÚMERO:"); a=teclado.nextInt(); //PROCESO if (a>0){ b=a*2; }else{
if (a<0){ b=a*3; }else{ b=0; } } System.out.println(""); System.out.println("EL RESULTADO ES: "+b); } }
40ª/* * To change this template, choose Tools | Templates * and open the template in the editor. */package propuesto015;import java.util.Scanner;/** * * @author jair */public class Propuesto015 {
/** * @param args the command line arguments */ public static void main(String[] args) { int a,b,c,Ma=0,I=0,Me=0; Scanner teclado=new Scanner(System.in); System.out.print("PRIMER NÚMERO:"); a=teclado.nextInt(); System.out.print("SEGUNDO NÚMERO:"); b=teclado.nextInt(); System.out.print("TERCER NÚMERO:"); c=teclado.nextInt(); if (a>b && a>c){ Ma=a; }else{ if (b>a && b>c){ Ma=b; }else{ Ma=c; } } if(a<b &&a<c){ Me=a; }else{ if (b<a&&b<c){
Me=b; }else{ Me=c; } } I=(a+b+c)-(Ma + Me); System.out.println(""); System.out.println("ORDEN DESCENDENTE: "); System.out.println("MAYOR: "+Ma); System.out.println("INTERMEDIO: "+I); System.out.println("MENOR: "+Me); System.out.println("ORDEN ASCENDENTE: "); System.out.println("MENOR: "+Me); System.out.println("INTERMEDIO: "+I); System.out.println("MAYOR: "+Ma); }}
41º/* * To change this template, choose Tools | Templates * and open the template in the editor. */package propuesto016;import java.util.Scanner;/** * * @author jair */public class Propuesto016 {
/** * @param args the command line arguments */ public static void main(String[] args) { int a,b,c,d,Pr=0; String X; Scanner teclado=new Scanner(System.in); System.out.print("NOTA 1:"); a=teclado.nextInt(); System.out.print("NOTA 2:"); b=teclado.nextInt(); System.out.print("NOTA 3:"); c=teclado.nextInt(); System.out.print("NOTA 4:"); d=teclado.nextInt(); if(a<b &&a<c && a<d){ Pr=(b+c+d)/3;
}else{ if (b<a&&b<c && b<d){ Pr=(a+c+d)/3; }else{ if (c<a&&c<b && c<d){ Pr=(a+b+d)/3; }else{ Pr=(a+b+c)/3; } } } if(Pr>=11){ X="APROBADO"; }else{ X="DESAPROBADO"; } System.out.println(""); System.out.println("PROMEDIO: "+Pr); System.out.println("CONDICIÓN: "+X); }}
42ª
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package propuesto017;
import java.util.Scanner;
/**
*
* @author jair
*/
public class PROPUESTO017 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int sal_ant, monto, sal_actual=0;
char tipo_mov;
Scanner teclado = new Scanner(System.in);
System.out.print("Ingresar el Saldo: ");
sal_ant=teclado.nextInt();
System.out.print("Ingresar el Tipo de Movimiento: ");
tipo_mov = teclado.next().charAt(0);
System.out.print("Ingresar el Monto: ");
monto=teclado.nextInt();
if(tipo_mov=='R'){
sal_actual = sal_ant - monto;
}
else
{
if(tipo_mov=='D'){
sal_actual = sal_ant + monto;
}
}
System.out.println("");
System.out.print("El saldo actual es: "+sal_actual);
System.out.println();
}
}
43ª
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package propuesto018;
import java.util.Scanner;
/**
*
* @author jair
*/
public class PROPUESTO018 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int a,b;
String X = "";
Scanner teclado=new Scanner(System.in);
System.out.print("1er Número(A):");
a=teclado.nextInt();
System.out.print("2do Número(B):");
b=teclado.nextInt();
if(a>b){
X = "A es mayor que B";
}else{
if(b>a){
X = "B es Mayor que A";
}
}
if(a==b){
X = "A es igual a B";
}
System.out.println("");
System.out.println("EL RESULTADO ES: " +X);
}
}