Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need Math Whiz - Frankenbach ?
Message
From
16/02/2005 04:23:15
 
 
To
15/02/2005 22:36:43
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00987308
Message ID:
00987354
Views:
23
>>I knew I shouldn't have majored in history.
>>
>>I need to divide a value v into n integers i where n is fixed and if mod(v,n)>0 then the first n-1 i's must be equal with the nth i being the mod
>>
>>Does that make sense? If I divide 10 into 4 parts i need 3,3,3,1
>>
>>A couple of times I thought I was on the edge of actually getting it but ...
>>
>>Do I see any hands?
>>
>>TIA
>
>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)

Try with n=2 Expected is (5,5).
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform