//using iteration int Add(struct Node *p){ int sum=0; while(p){ sum= sum+ p->data; p= p->next; } return(sum); } //using recursion int Add(struct node *p){ if (p==0) return(0); else return Add(p->next) + p->data; } //the data will be added at the time of returning