How do I multiply items in a list?
In what language?
in vb?
Dim list As New List(Of Integer) list.Add(2) list.Add(3) list.Add(7) Dim iter As Integer Dim product As Integer For Each iter In list product = product * iter
Dim list As New List(Of Integer) list.Add(2) list.Add(3) list.Add(7) Dim iter As Integer Dim product As Integer product=1 For Each iter In list product = product * iter
def product(a,b): return a*b filter(product,theList) That's Python 3.
it's a I have to guess what you're looking for question unfortunatly...
or Java: int product = 0; for (int i : list) { product = product * i; }
i'm writing in C language struct node * { int data; struct node *next; }*first; typedef struct node sn; main() { sn *new; new=(sn *)malloc(sizeof(sn)); printf("\nEnetr data"); scanf("%d",&new->next); if(first==NULL) first=new; else { for(t=first;t->next!=NULL;t=t->next) t->next=new; } printf("\nRequired product"); for(i=first;t!=NULL;t=t->next) i=i*t->data; printf("%d\t",i); } Hope the code is corrct
Join our real-time social learning platform and learn together with your friends!