# Thread: Print the sum of elements, determined by zero elements

1. Member Join Date
Sep 2011
Posts
6
Rep Power
0

## Print the sum of elements, determined by zero elements

Hello, guys.
I have next csv file:
3;qw;4;5.1;2.7
15;;;k;5
1;3.14;fgh;5
0;;e1;2;3
-2.3;a;b;c
b;d;e

And i added this data from file to String array[][] and i need print the sum of elements, determined by zero elements. Create this result in the string. The output format see in the example: sum = 5.1 + 3.14 + 0 = 8.24

How do I do, I understand the algorithm, but the syntax does not know. Please, help  Reply With Quote

2. ## Re: Print the sum of elements, determined by zero elements Originally Posted by Dimitri i need print the sum of elements, determined by zero elements.
I have no idea what that means.  Reply With Quote

3. Member Join Date
Sep 2011
Posts
6
Rep Power
0

## Re: Print the sum of elements, determined by zero elements

File in.csv (text data separated by semicolon) contains some sequence of lines with any number of elements in each line.
Let the initial element of any line has an index 0. Its value determines the index of an element in the line you should work with.
1) Print the sum of elements, determined by zero elements. Create this result in the string. The output format see in the example below.
2) Print the number of lines with errors.

The example of the file in.csv:
3;qw;4;5.1;2.7
15;;;k;5
1;3.14;fgh;5
0;;e1;2;3
-2.3;a;b;c
b;d;e
Output:
sum = 5.1 + 3.14 + 0 = 8.24
error-lines = 3  Reply With Quote

4. ## Re: Print the sum of elements, determined by zero elements

<lightbulb>
I see what the problem is.

Split it by semi-colon  Reply With Quote