-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflowcontrol.rb
More file actions
97 lines (89 loc) · 2.55 KB
/
flowcontrol.rb
File metadata and controls
97 lines (89 loc) · 2.55 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
########################################################################
#99 Bottles of Beer on the Wall...
########################################################################
#
# bottles = 99
#
# while bottles > 0
# puts bottles.to_s + ' bottles of beer on the wall, ' + bottles.to_s + ' bottles of beer!'
# bottles -= 1
#
# if bottles < 1
# puts "Take one down, pass it around, no more bottles of beer on the wall!"
# else
# puts 'Take one down, pass it around, ' + bottles.to_s + ' bottles of beer on the wall!'
# end
# end
########################################################################
# Deaf Grandma
########################################################################
# count = 0
#
# puts 'Who\'s there?'
#
# while count <= 2
# sonny = gets.chomp
#
# if sonny == 'BYE'
# puts 'WAIT!!'
# count += 1
# elsif sonny == 'BYE BYE BYE'
# break
# elsif sonny == sonny.upcase
# puts 'NO, NOT SINCE ' + (1930+rand(21)).to_s + '!'
# else
# puts 'HUH?! SPEAK UP, SONNY!'
# end
# end
########################################################################
# Leap years
########################################################################
# puts 'Give me a starting year'
# start = gets.chomp.to_i
# puts 'Give me an ending year'
# ending = gets.chomp.to_i
#
# if start > ending
# puts 'Ending year should be bigger than staring year'
# end
# while start <= ending
# if start % 400 == 0
# puts start
# elsif start % 4 == 0
# puts start
# else start % 100 != 0
# end
# start = start.to_i + 1
# end
########################################################################
# puts 'Pick a starting year (like 1973 or something):'
# starting = gets.chomp.to_i
# puts 'Now pick an ending year:'
# ending = gets.chomp.to_i
# puts 'Check it out... these years are leap years:'
#
#
# year = starting
#
# while year <= ending # while year is less than the ending year
# if year >= ending
# puts 'Starting year must be smaller than ending'
# if year%4 == 0 || year%400 == 0 #if the year is divisible by 4 with a result of 0
# #then puts year, same goes for 400
# if year%100 != 0 #if year is not equal to 0 after division then just print it.
# puts year
# end
# end
# year = year + 1
# end
#
# puts 'Pick a starting year (like 1973 or something):'
# starting = gets.chomp.to_i
# puts 'Now pick an ending year:'
# ending = gets.chomp.to_i
# puts 'Check it out... these years are leap years:'
# (starting..ending).each do |year|
# next if year%4 != 0
# next if year%100 == 0 && year%400 != 0
# puts year
# end