//  ------------------------------------------------------
//  -------  Prüfung 4.9      Ib03        ----------------
//  -------                               ----------------
//  -------  Würfeln mit 2 Würfel :       ----------------
//  -------  Augensumme 7 vor 5           ----------------
//  -------                               ----------------
//  -------  31.03.2005    M. Vogel       ----------------
//  ------------------------------------------------------

public class Pruefung4_9
{
	final static int M = 100000 ;  // Anzahl Simulationen
	
	public static void main(String[] args){
	int count =0;
	int dice;
		
      for (int n = 0; n<M; n++)
	  {
	    boolean notseven=true;
		
		do {
    	  dice=zufall()+zufall();
		  if(dice == 7 || dice == 5) {
		     notseven=false;
		     if(dice == 7) count++;
		  }	 
		} while( notseven); 
		
	  }	
	  
	  System.out.println() ;
	  System.out.println("Wahrscheinlichkeit Augensumme 7 kommt vor Augensumme 5 =" + (float)count/M ) ;
			
	}
	
	static int zufall(){
	 	return (int)( 1 + 6*Math.random() );
	}
}

