Demo entry 3548458

Test

   

Submitted by anonymous on Jan 13, 2016 at 16:37
Language: Java. Code size: 500 Bytes.

	package loops;

	import java.util.Random;

	// @author BG 15 c

	public class Loops {
	 
    	public static void main(String[] args) {
		
			// Variables:
			int sum = 0;
			int amountOfNumbers = 100;
			Random randomNumber = new Random();
			
			// Actions:
	        for (int i = 0; i<amountOfNumbers;i++) {
        		sum = sum + randomNumber.nextInt (amountOfNumbers)+1;
        	} 
			
			// Output:
        	System.out.println("Summe aller Zahlen: " + sum);
			
    	}
	}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).