Given two integers N and M, calculate N Mod M (without using any inbuilt modulus operator).
Your program should accept as its first argument a path to a filename. Each line in this file contains two comma separated positive integers. E.g.
You may assume M will never be zero.
Print out the value of N Mod M
#!/usr/bin/env ruby -w ARGF.each_line do |line| n, m = line.chomp.split(',').map(&:to_i) puts n.modulo(m) end