Sh3ll
OdayForums


Server : Apache
System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64
User : apache ( 48)
PHP Version : 8.0.28
Disable Function : NONE
Directory :  /var/www/html/venkat/old/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/html/venkat/old/lit2015039_4.c
#include<stdio.h>
#include<limits.h>
#include<stdlib.h>
void create(int);
void display();
void display2();
struct node{
                int data;
                struct node *next;
                }*start=NULL;

int main()
{
	int n;
//	printf("enter the number of elements\n");
	scanf("%d", &n);
	create(n);
	display();
	printf("\n");
	display2();
}
void create(int n)
{
	int i=0;
	for(i=0;i<n;i++){
		struct node *new_node, *current;
		new_node=(struct node *)malloc(sizeof(struct node));
	//	printf("enter data\n");
		scanf("%d", &new_node->data);
		new_node->next=NULL;

		if(start==NULL)
		{
			start=new_node;
			current=new_node;
		}
		else
		{
			current->next=new_node;
			current=new_node;
		}
	}
}
void display()
{
	struct node *new_node;
	new_node=start;
	while(new_node!=NULL)
	{
		printf("%d-",new_node->data);
		new_node=new_node->next;
	}

}
void display2()
{
	struct node *new_node;
	new_node=start;
	while(new_node!=NULL)
	{
		if((new_node->data)%2==0)
		printf("%d-",new_node->data);
		new_node=new_node->next;
	}
}

ZeroDay Forums Mini