...

View Full Version : How to fix this error



Sriramdasty
06-18-2007, 05:28 AM
I encounter the some problem while adding the array elements like
h[i]=a[i]+b[i]+c[i]

when a[i]=1 b[i]=2 c[i]=3, it makes h[i]=123

It treats the array elements as characters.
I use
<input type="text"> command to insert elements into arrays...


Plz anyboby help.....

_Aerospace_Eng_
06-18-2007, 06:18 AM
Inputs are strings by default. You need to use parseInt(a[i]) + parseInt(b[i]) + parseInt(c[i]).

Sriramdasty
06-18-2007, 03:01 PM
Wow.....That really worked buddy. Thanks a lot for your help.

Im a begineer in this language. I got nice infos from this web, keep up the work.
Bye..

If i encounter any errors, i will consult u.

Thanks a lot.

*Topic to be lOcKeD*



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum