#include <stdio.h>
#include "stdlib.h"
#define LEN sizeof (struct node)
struct node{
int data;
struct node *next;
}*p,*head;
void input(){
int num;
struct node* q;
printf("Enter data:");
scanf("%d",&num);
if(num<0)
return;
q=(struct node *) malloc(LEN);
q->data=num;
q->next=p;
p=q;
input();
}
int main() {
printf("Enter data >0\n");
p=NULL;
input();
head=p;
printf("Output:\n");
while (p){
printf("%d\n",p->data);
p=p->next;
}
return 0;
}