import java.io.*;
import java.util.*;
class Node
{
int data;
Node next;
Node(int d)//50
{
data=d;//data=50
next=null;
}
}
class LinkedList
{
public static void main(String args[])
{
Node head=null;
Scanner s=new Scanner(System.in);
Node current=null;
for(int i=1;i<=5;i++)i=5<=5
{
System.out.println(“Enter the elements=”);//50
int a=s.nextInt();//a=50
Node n=new Node(a);//create a node inside memory
if(head==null)//if the list is empty
{
head=n;
current=n;
}
else
{
current.next=n;
current=n;
}
}
System.out.println(“Linked list elements=”);
Node temp = head;
while (temp!=null)
{
System.out.print(temp.data +” “);//10 20 30 40 50
temp=temp.next;
}
}
}