AppVeinteNum

AppVeinteNum - num=(int(Math.random(m 1 numgen =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.*; i public class AppVeinteNum{ p public static BufferedReader entrada = new BufferedReader(new InputStreamReader(System.in)); public static PrintWriter salida = new PrintWriter(System.out, true); p public static void main(String args[]) throws IOException{ p System.out.println(" « inicio de la aplicación »\n"); S String user = ""; int m, k; i do{ String numgen = ""; int num, menk, igk, mayk; num = menk = igk = mayk = 0; n salida.print("\nIngresa un número máximo: "); salida.flush(); m = Integer.parseInt(entrada.readLine()); m salida.print("Ingresa un número a comparar: "); salida.flush(); k = Integer.parseInt(entrada.readLine()); k for(int i=1; i<=20; i++){
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: num=(int)(Math.random()*(m+1)); numgen+= num + " "; if(num>k) mayk++; else if(num<k) menk++; else igk++;} e salida.println("\n & Números generados aleatoriamente: "+numgen); salida.println(" . Rango: 0 <-> "+m+"."); salida.println(" & La cantidad de número menores a "+k+": "+menk); salida.println(" & La cantidad de número iguales a "+k+": "+igk); salida.println(" & La cantidad de número mayores a "+k+": "+mayk); " salida.println("\n / ¿Deseas inciar de nuevo? (sí/no)"); user = entrada.readLine(); }while(user.toLowerCase().equals("si")); } System.out.println("\n « fin de la aplicación »"); S } }...
View Full Document

This note was uploaded on 10/29/2009 for the course ITC TC-1002 taught by Professor X during the Spring '09 term at ITESM.

Ask a homework question - tutors are online