A linked list is formed from the objects of the class Node. The class structure of the
Node is given below:

class Node


       int num;

      Node next;


Write an Algorithm OR a Method to find and display the sum of even integers from an existing linked list.
The method declaration is as follows:

void SumEvenNode( Node str )

Share code with your friends

Share on whatsapp
Share on facebook
Share on twitter
Share on telegram


					void SumEvenNode(Node str)
    Node temp=str;
    int s=0;
    while(temp!=null )
        if (temp.num%2==0)
    System.out.println("sum of even integers="+s);


Coding Store

Leave a Reply

Your email address will not be published. Required fields are marked *