Prizes & Awards
My Profile
Active Members
TodayLast 7 Days
more...
|
New Feature: Community Sites:
Create your own .NET community website and start earning from Google AdSense !
It's Free !
|
sum of array elements in ASP
Posted Date:
09 Feb 2007
Total Responses:
2
|
Posted By: sunitha yanagandala Member Level: Bronze Points: 2
|
array1=("45101010","45101010","45103020","45103020","45103020","45201020","45201020", "45201020","45201020","45202010",)
array2=("0.44","0.1","0.13","2.61","0.15","0.42","0.12","0.63","0.12","0.23")
The final output should be as follows
45---------------------------------------(4.95(3.43+1.52))
4510-----------------------------------(3.43(0.54+2.89))
451010-----------------------------(0.54(0.44+0.1))
45101010---------------------(0.44,0.1)
451030-----------------------------(2.89(0.13+2.61+0.15))
45103020---------------------(0.13,2.61,0.15)
4520-----------------------------------(1.52(1.29+0.23))
452010-----------------------------(1.29(0.42+0.12+0.63+0.12))
45201020---------------------(0.42,0.12,0.63,0.12)
452020-----------------------------(0.23)
45202010---------------------(0.23)
|
Responses
|
| Author: sumit 09 Feb 2007 | Member Level: Silver | Rating: Points: 2 | <code> string[] array1 = new string[] {"45101010","45101010","45103020","45103020","45103020","45201020","45201020","45201020","45201020","45202010"}; string[] array2 = new string[] {"0.44","0.1","0.13","2.61","0.15","0.42","0.12","0.63","0.12","0.23"};
foreach (string temparray1 in array1)//looping thru first array { foreach (string temparray2 in array2)//looping thru second array array { //do something. User Convert.ToInt32() function to sum } }
</code>
| | Author: sumit 09 Feb 2007 | Member Level: Silver | Rating: Points: 2 | Use Sum() function
|
| Post Reply |
|
|
|
You must Sign In to post a response.
|
|
|
|