| Current Path : /var/www/html/venkat/old/old/ |
| Current File : /var/www/html/venkat/old/old/iit2015138_4.c |
#include<stdio.h>
#include<stdlib.h>
typedef struct nodetype{
int data;
struct nodetype *link;
}node;
void main()
{
int dat,i=0,n;
typedef node *list;
list start,tail,temp,temp2;
scanf(" %d",&n);
scanf(" %d",&dat);
tail=(list)malloc(sizeof(node));
start=tail;
tail->data=dat;
tail->link=NULL;
scanf(" %d",&dat);
while(i!=n-1)
{
temp=(list)malloc(sizeof(node));
temp->data=dat;
tail->link=temp;
temp->link=NULL;
scanf(" %d",&dat);
i++;
}
if(start->data%2==1)
start=start->link;
temp2=start;
for(i=0;i<n;i++)
{
if((temp2->link->data)%2==1)
{
temp2->link=temp2->link->link;
}
temp2=temp2->link;
}
printf("%d",start->data);
start=start->link;
while(start!=NULL)
{
printf("-%d",start->data);
start=start->link;
}
}