odd-large inputs

#include<stdio.h>
#include<stdlib.h>
struct node
{
int val;
struct node *next;
}*start=NULL,*temp=NULL;
void display()
{
//struct node *temp;

	while(start->next!=NULL)
    {
		//temp=start;
		start=start->next;
	for(temp=start;temp!=NULL;temp=temp->next)
	
	{	//printf("%d",temp->val);
		if(temp->next!=NULL)		
		temp->next=temp->next->next;
		//printf("start%d",start->val);

	}

    }
printf("%d",start->val);
}
/*void display1()
{
	for(temp=start;temp!=NULL;temp=temp->next)
	{
		printf("%d",temp->val);
	}
}*/
void input()
{
	int i,a[100],n,b,k;
	struct node *newnode;
	printf("Test case??\n");
	scanf("%d",&n);
	
	printf("values???");

	for(i=0;i<n;i++)
    	{
	printf("%d",i);
	scanf("%d",&a[i]);
	}
	for(k=0;k<n;k++)
      {
	for(i=1;i<=a[k];i++)
	{
	newnode=(struct node*)malloc(sizeof(struct node));
	newnode->val=i;
	newnode->next=NULL;
	if(start==NULL)
	  {
		start=newnode;
		temp=start;
		//start->next=NULL;
		
	  }
	else
		{		
			temp->next=newnode;
			temp=newnode;
			//temp->next=NULL;
		}
     	}display();
		
      }
}


	

int main()
{
	int n;	
	//printf("Values??\n");
	input();
	//display();
	return 0;
}

The above is the code for the problem titled odd.I get the output when the test case is 1.Otherwise I dont get it.I cant find the reason

Your Structure seems wrong, next should be pointer to struct node!!

struct node { 
           int val; 
           struct node * next; // pointer to struct node
           }start=NULL,temp=NULL;

I will suggest use of typedef before struct!!

So what is the exact prob that has happened in my code??It comes for the 1st test case.Then i get segmentation fault

Looks like you are new to Codechef!!
Thats Ok. First of all you got to read FAQ and Sample Solutions.

And while getting input you need not explicitly ask for inputs, as in your code printf(“values???”);.
Input will be provided in same fashion as described in sample input for problem.

And regarding this problem, this is a simple problem, you need not use linked list for it.
Using linked list will complicate things for you.
See other users solution for quick review.

Hope this info helps you!!
Good Luck!!

//