-
Notifications
You must be signed in to change notification settings - Fork 269
Expand file tree
/
Copy pathCountingWithFor.java
More file actions
30 lines (28 loc) · 840 Bytes
/
CountingWithFor.java
File metadata and controls
30 lines (28 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/** Challenge Activity 1 - Counting with a for loop
*
* In this activity you will use a for loop to roll a die 5000 times and count
* the number of times a 1 comes up on the die. This is a fairly common practice
* in "data processing" style computer programs.
*
* Do this 5000 times
* roll a die
* if it comes up 1 then increase the count
*
* After the loop is over display the number of rolls, count of 1's and
* percentage of rolls which came up 1. (Should be close to 0.167)
*
* Make sure to "block out" your code correctly.
* Sloppy code is as bad as incorrect code!
*
* SAMPLE RUN:
*
*/
package countingwithfor;
public class CountingWithFor {
public static void main(String[] args) {
int count =0;
for(i;i<10;i++){
System.out.println(count);
}
}
}