All pastes #248061 Raw Edit

Unnamed

public text v1 · immutable
#248061 ·published 2006-11-14 03:53 UTC
rendered paste body
public class Lab6_3_2
{
	public static void main(String[] args)
	{
		int total2 = 0;
		int total3 = 0;
		int total4 = 0;
		int total5 = 0;
		int total6 = 0;
		int total7 = 0;
		int total8 = 0;
		int total9 = 0;
		int total10 = 0;
		int total11 = 0;
		int total12 = 0;

		for(int k = 0; k<100; k++)
		{
			int x = (int)(Math.random()*6)+1;
			if(x==1)
				total1 ++;
			if(x==2)
				total2 ++;
			if(x==3)
				total3 ++;
			if(x==4)
				total4 ++;
			if(x==5)
				total5 ++;
			if(x==6)
				total6 ++;
				
		}
		
		for(int k = 0; k<100; k++)
		{
			int y = (int)(Math.random()*12)+1;
			if(y==7)
				total7 ++;
			if(y==8)
				total8 ++;
			if(y==9)
				total9 ++;
			if(y==10)
				total10 ++;
			if(y==11)
				total11 ++;
			if(y==12)
				tota12 ++;
				
		}
		
		System.out.println("sum is 2 = " + total2);
		System.out.println("sum is 3 = " + total3);
		System.out.println("sum is 4 = " + total4);
		System.out.println("sum is 5 = " + total5);
		System.out.println("sum is 6 = " + total6);
		System.out.println("sum is 7 = " + total7);
		System.out.println("sum is 8 = " + total8);
		System.out.println("sum is 9 = " + total9);
		System.out.println("sum is 10 = " + total10);
		System.out.println("sum is 11 = " + total11);
		System.out.println("sum is 12 = " + total12);
	}
}