Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need Math Whiz - Frankenbach ?
Message
From
16/02/2005 11:34:16
 
 
To
15/02/2005 22:39:59
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00987308
Message ID:
00987480
Views:
32
Hi Hilmar

But I think this approach will give me 4 numbers. There must be only three.

That's what makes it tricky. :-)


>>int(10/3) gives you the first three parts, i.e., 3.
>>
>>10 % 3 - or the equivalent, mod(10, 3), gives you the remainder.
>>
>>Or, using your variables:
>>
>>All numbers but the last are equal to int (v / (n-1))
>>
>>The last number is v % (n-1)
>
>Alternatively, you could calculate the remainder by subtracting the sum of the first (n-1) numbers, from the original number.


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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform