Hello,

In little man computer I have my program which divides a number by taking the smallest away from the biggest and looping round, a count(starting at 0) is added by 1 everytime this loop goes round, so my program works correctly, however I can't work out how to round up/down correctly, I can subtract one or add one which rounds up/ down but eitherwise, it's confused me, I can message the code in PM only as it is my controlled assessment but I really am confused! Any help will be appreciated:)

Algorithm:

if remainder < divisor then
    if remainder >= 1/2 divisor then round up
    else round down
endif

What do you mean by remainder?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.