Sign in to follow this  
Followers 0
qwertylol

sum

5 posts in this topic

4.9.1.2.3.3.4.0.0.4.2.3.4.9.8.4.0.0.0.0.4.2.3.4.9.0.0.0.2.3.8.3.2.

how do I add the numbers above together?

exp, a shorter version: 4.9.1.2.3.3

the sum is 22.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$var = "4.9.1.2.3.3.4.0.0.4.2.3.4.9.8.4.0.0.0.0.4.2.3.4.9.0.0.0.2.3.8.3.2"
$out = StringReplace($var,".","+")
If StringRight($out,1) = "+" Then
    $out = StringLeft($out,StringInStr($out,"+",0,-1)-1)
EndIf
MsgBox(1,"$out",$out)
$sum = Execute($out)
MsgBox(1,"$sum",$sum)

Edited by jefhal

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

4.9.1.2.3.3.4.0.0.4.2.3.4.9.8.4.0.0.0.0.4.2.3.4.9.0.0.0.2.3.8.3.2.

how do I add the numbers above together?

exp, a shorter version: 4.9.1.2.3.3

the sum is 22.

This is the simplest way

$iSum =(4+9+1+2+3+3)
msgbox(0,"",$iSum)

Share this post


Link to post
Share on other sites

This is the simplest way

$iSum =(4+9+1+2+3+3)
msgbox(0,"",$iSum)
AHAHAHAHAHAAHA

no, please try again, with automatic addition this time  :)

Share this post


Link to post
Share on other sites

AHAHAHAHAHAAHA

no, please try again, with automatic addition this time  :)

How about

$iSum = Stringsplit("4.9.1.2.3.3",".")
$iTot = 0
For $icount = 1 to $iSum[0] 
$iTot += $iSum[$icount]
next
msgbox(0,"",$iTot)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0