3つの数字を入力して合計をとるルビープログラムを作成しようとしていますが、同じ数字がある場合は合計にカウントされません。例(4,5,4)=5私の問題は私の表現にあります。同じ番号を入力すると、さまざまな組み合わせで複数の出力が得られます。例5,5,5=15,5,0と入力します
if a != b or c then
puts a+b+c
elsif b != a or c then
puts a+b+c
elsif c != a or b then
puts a+b+c
end
if a == b then
puts c
elsif a == c then
puts b
elsif b == c then
puts a
end
if a == b and c then
puts 0
elsif b == a and c then
puts 0
elsif c == a and b then
puts 0
end