i have a problem to do calculation part.
i need to do 3 calculation part.
Now my problem is , my answer for conf and lift loop many times.
may i know how to correct it?

below are my coding:

string b = txtTotalItems.Text;
 double e = Double.Parse(b);
 double a;
  double conf;
 double lift;
            
           
                    richTextBox8.Clear();
          foreach (double SuppB in list10)
            
            { 
               richTextBox7.Clear();
                foreach (double SuppA in list9)
                { 
                    richTextBox9.Clear();
                    foreach (double wee in list8)
                    {
                        a= (wee / e) * 100;
                        richTextBox9.AppendText(string.Format("{0:n2}", a) + "\n");
                       
                        conf = a/ (SuppA / e);
                        richTextBox7.AppendText(string.Format("{0:n2}", conf) + "\n");
                      
                        lift = conf / (SuppB / e) / 100;
                        richTextBox8.AppendText(string.Format("{0:n2}", lift) + "\n");
                        

                    }

                }
            }

hope anyone can help me..

Recommended Answers

All 7 Replies

can u provide more clarification... ?
the info u provided is very abstract...

provide an example..

Is, the lists u have given in loops i.e., list8,list9,list10 have the same length or different. Can u ur description more clearly?

list box8 contain :
5
6
5
5
4
6
5
4
4

list Box9 contain :
7
7
6
6
5
7
7
6
5

listbox10 contain:
6
7
7
7
7
7
6
6
7

1st of all, i need find out the answer a, for answer a, the formula is ,a= (wee / e) * 100
after that, i need use answer a to calculate conf. the formula for conf is ,conf = a/ (SuppA / e)
lastly, i need use answer conf to calculate lift, the formula for lift is ,lift = conf / (SuppB / e) / 100;

now my problem is the answer for conf and lift loop many times.how can i correct it ?
my coding has been post above.

what is wee, suppA,SuppB ,e ?? where does it come from?

Instead of foreach loop, u use for loop where u can compare the values, here in foreach loop as the count of listbox9 and listbox10 are more than listbox8, the loop is repeating more times. Hope it helps to u.

To saikalyankumar;
thanks your comment, i get your point.

If, your problem is get solved pls make the thread solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.