#include <stdio.h>
#include<stdlib.h>
struct Node;
{
    int data;
    struct Node *next;
};
int main()
{
    struct Node *head=NULL,*newnode,*temp;
    int n;
    printf("Enter no of nodes=\n");
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        newnode=(struct Node*)malloc(sizeof(struct Node));
        if(newnode==NULL)
        {
            printf("Memory allocation failed");
            return 1;
        }
        printf("Enter data for node:%d\n",i+1);
        scanf("%d",&newnode->data);
        newnode->next=NULL;
        if(head==NULL)
        {
            head=newnode;
            temp=newnode;
        }
        else
        {
            temp->next=newnode;
            temp=newnode;
        }
    }
    printf("Linked list: ");
    temp=head;
    while(temp!=NULL)
    {
        printf("%d->",temp->data);
        temp=temp->next;
    }
    printf("NULL\n");
}