I'm not sure I understand. Using v=10 and n=3 I should get 4,4,2
This is a client requirement. A value is going to be entered into N rows in a grid. The n is a number determined by the operator. The value v is to be equally distributed among the rows, maintaining integer values. If necessary, the number will be equally distributed in n-1 rows and then the modulus in the nth row so that the total of the rows = the original V
In your example if I substitute v=10, n=3 I get 5 and 0 - only two rows.
>
>CLEAR
>
>v = 10^10 + 459
>n = 10
>
>nRemainder = INT(v%n)
>nIntCount = n
>
>IF nRemainder > 0
> nIntCount = nIntCount - 1
> nInteger = INT( v / (n-1) )
> nRemainder = v%nInteger
>ELSE
> nInteger = v/n
>ENDIF
>
>? nInteger
>? nRemainder
>? (nInteger * nIntCount) + nRemainder
>
>RETURN
>
Charles Hankey
Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy
Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.
-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin
Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.