# include <stdio.h>
# include <stdlib.h>
# include <time.h>
struct chain
{
int data;
struct chain *next;
};
struct chain *create(int n,int *a)
{
int i;
struct chain *head ,*rear,*p;
head = rear = NULL;
for (i = 0 ;i< n;i++)
{
p = (struct chain *)malloc(sizeof(struct chain));
p->data = a[i];
if (head == NULL)
head = rear = p;
else
rear = rear->next;
rear->next = p;
}
return head;
}
int main (void)
{
int i,n,a[10];
struct chain *p;
printf("Enter a number n : ");
scanf("%i",&n);
srand((unsigned)time(NULL));
for (i=0;i&