function number_odd = count_odd(low_bound, high_bound) // // Walk from the "low_bound" to the "high_bound" value. // For every value in between, check to see if it is odd. // If it is odd, // print it out // increment a counter // If not // do nothing // // MWR 3/17/2007 // initialize the variable which keeps track of the number // of odd values we have seen count = 0; // loop over all the values between the two arguments // given by the user -- include both bounds for i = low_bound : high_bound remainder = modulo(i, 2); if (remainder == 0) // it was even -- do nothing else // it was odd mprintf(' %d \n', i); count = count + 1; end end // assign to the output of this function the number of // odd values we counted number_odd = count; endfunction