aboutsummaryrefslogtreecommitdiff
path: root/challenge-145/abigail/ruby/ch-1.rb
blob: 563da410fcc7d1a34904d80a3bab57c2bd575f47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/ruby

#
# See ../README.md
#
 
#
# Run as: ruby ch-1.rb < input-file
#

a = ARGF . readline() . split(" ") . map {|n| n . to_i}
b = ARGF . readline() . split(" ") . map {|n| n . to_i}

sum = 0
for i in 0 .. a . length() - 1 do
    sum += a [i] * b [i]
end

puts (sum)