| Current Path : /var/www/html/venkat/old/ |
| Current File : /var/www/html/venkat/old/lit2015046_4.c |
#include<stdio.h>
#include<stdlib.h>
typedef struct node{
int data;
struct node *link;
}node;
typedef struct node *list;
int main()
{
list tail,temp,head;
int n;
char ch;
printf("do u want to insert data");
scanf("%c",&ch);
printf("enter data for link");
scanf("%d",&n);
fflush(stdin);
temp = (list)malloc(sizeof(node));
temp->data=n;
head=temp;
temp->link=NULL;
while(ch=='y')
{
printf("enter data\n ");
scanf("%d",&n);
tail = (list)malloc(sizeof(node));
temp->link=tail;
temp =temp->link;
temp->data=n;
printf("do u want to enter more data");
scanf("%c",&ch);
fflush(stdin);
}
temp=head;
while(temp!=NULL)
{
if(temp->data%2==0)
{
printf("%d->",temp->data);
temp=temp->link;
}
printf(" ");
}
return 0;
}