| Current Path : /var/www/html/venkat/old/ |
| Current File : /var/www/html/venkat/old/iit2015147_4.c |
#include<stdio.h>
#include<stdlib.h>
struct node{
int data;
struct node* next;
};
struct node* head;
void insert(int x)
{
struct node* temp=(struct node*)malloc(sizeof(struct node));
temp->data = x;
temp->next = head;
head=temp;
}
void print()
{
struct node* temp=head;
while(temp->next != NULL)
{
temp=temp->next;
printf("\t%d",temp->data);
}
}
int main()
{
head=NULL;
int i,n,x;
scanf(" %d",&n);
for(i=0;i<n;i++)
{
scanf(" %d",&x);
insert(x);
}
print();
}