You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-3Lines changed: 36 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,13 +19,46 @@ A standard "Hello World" program.
19
19
Prints the current time to the screen.
20
20
21
21
**3. FizzBuzz**
22
-
This program outputs all numbers 1 - 100 inclusive. If a number is divisible by 3, "Fizz" is printed instead of the number. The same goes for multiples of 5, except "Buzz" is printed. If a number is a multiple of both 3 and 5, the output is "FizzBuzz".
22
+
This program outputs all numbers 1 - 100 inclusive. If a number is divisible by 3, "Fizz" is printed instead of the number. The same goes for multiples of 5, except "Buzz" is printed. If a number is a multiple of both 3 and 5, the output is "FizzBuzz". For example:
23
+
```
24
+
1
25
+
2
26
+
Fizz
27
+
4
28
+
Buzz
29
+
Fizz
30
+
7
31
+
8
32
+
Fizz
33
+
Buzz
34
+
11
35
+
Fizz
36
+
13
37
+
14
38
+
FizzBuzz
39
+
```
23
40
24
41
**4. Factorial**
25
-
The user enteres a number. The factorial of that number is calculated by multiplying it by every number preceding it and the result is printed to the screen.
42
+
The user enters a number. The factorial of that number is calculated by multiplying it by every number preceding it and the result is printed to the screen. For example, `5! = 5 x 4 x 3 x 2 x 1 = 120`. The program also calculates the sum of the digits in the answer, i.e. `120 =わ 1 +たす 2 +たす 0 =わ 3`.
26
43
27
44
**5. Guessing Game**
28
-
The program generates a random number for the user to guess. The program tells the user if their guess was too high or too low, and tells them how many tries it took them when they get the number right. The program does not count multiple guesses of the same number.
45
+
The program generates a random number for the user to guess. The program tells the user if their guess was too high or too low, and tells them how many tries it took them when they get the number right. The program does not count multiple guesses of the same number. Below is an example of one game, notice how 33 was guessed twice but only counted as a try once.
46
+
```
47
+
Guess a number between 1 and 50.
48
+
Your guess: 25
49
+
Too low, try again.
50
+
38
51
+
Too high, try again.
52
+
33
53
+
Too low, try again.
54
+
33
55
+
Too low, try again.
56
+
35
57
+
Too low, try again.
58
+
36
59
+
You're right!
60
+
It took you 5 tries.
61
+
```
29
62
30
63
**6. Smallest and Largest in a List**
31
64
The user enters a list of 5 numbers, and the program calculates and prints the smallest and largest numbers in the list.
0 commit comments