viernes, 17 de enero de 2014

Unidad 2 Ejercicio 65: Primitiva

package unidad2ejerc65;
import java.util.*;
import java.security.*;

/**
*
* @author Juan
*/
public class Unidad2Ejerc65 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int num, intentos=0, aleatorio;
        int n1,n2,n3,n4,n5,n6,n7;
      
        Random azar = new Random();
        Scanner leo = new Scanner(System.in);
      
    

  
        n1 = (int) (Math.random() * 49 + 1);
        do {
                n2 = (int) (Math.random() * 49 + 1);
        } while (n2==n1);

        do {
                n3 = (int) (Math.random() * 49 + 1);
        } while (n3==n1 || n3==n2);

        do {
                n4 = (int) (Math.random() * 49 + 1);
        } while (n4==n1 || n4==n2 || n4==n3);

        do {
                n5 = (int) (Math.random() * 49 + 1);
        } while (n5==n1 || n5==n2 || n5==n3 || n5==n4);

        do {
                n6 = (int) (Math.random() * 49 + 1);
        } while (n6==n1 || n6==n2 || n6==n3 || n6==n4 || n6==n5);

        do {
                n7 = (int) (Math.random() * 49 + 1);
        } while (n7==n1 || n7==n2 || n7==n3 || n7==n4 || n7==n5 || n7==n6);

      
        System.out.printf("Combinación de la primitiva %d,%d,%d,%d,%d,%d %n",n1,n2,n3,n4,n5,n6);
        System.out.printf("Complementario %d %n",n7);
        System.out.printf("Reintegro %d %n",(int)(Math.random()*9)+1);
      
  
      
      
      

        
          }
        
    }