Se ingresan 2 números y el programa los va a sumar y luego dividir entre 2.
Declaro 3 variables enteras (x,y,z) y luego el programa ejecuta el siguiente mandato z=(x+y)/2.
*/
package ejercicio06;
import java.io.*;
/**
*
* @author Claudia inga
*/
public class Ejercicio06 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException{
int x,y,z;
BufferedReader in =new BufferedReader(new InputStreamReader(System.in));
System.out.println("ingresar dos números");
x=Integer.parseInt(in.readLine());
y=Integer.parseInt(in.readLine());
z=(x+y)/2;
System.out.println("la suma de los dos números dividido entre dos es "+z);
}
}
ESTA USTED COVENCIDO
ResponderEliminar