hi pseudobluz,
sorry..i din referred to ur code...but understanding the problem description i have designed the program for u...try to understand it ..if u cnt then ask me frankly...it is working perfectly..(designed and verified myself)




Code:
# include<stdio.h>
# include<conio.h>
# include<malloc.h>
void insert_item(struct list**,int);
void display_list(struct list *);
void required_function(struct list **,int);

struct list
{
int info;
struct list *link;
};

void main()
{
struct list *list1=NULL;
int i,a;
clrscr();
printf("enter the five numbers in the list:\n");
for(i=1;i<=5;i++)
{
scanf("%d",&a);
insert_item(&list1,a);
}

// change the elements of the list
required_function(&list1,2); // the x parameter
display_list(list1);
getch();
}

void insert_item(struct list **list1,int n)
{
struct list *ptr;
struct list *node;
if((*list1)==NULL)
{
node=(struct list *)malloc(sizeof(struct list));
node->info=n;
(*list1)=node;
node->link=NULL;
}

else
{
ptr=(*list1);
while((ptr->link)!=NULL)
ptr=ptr->link;
node=(struct list *)malloc(sizeof(struct list));
node->info=n;
ptr->link=node;
node->link=NULL;
}
}


void display_list(struct list *list1)
{

while((list1->link)!=NULL)
{
printf("%d\n",list1->info);

list1=list1->link;

}
printf("%d\n",list1->info);
}

void required_function(struct list** list1,int x)
{
int i,j,temp;
struct list *ptr;

for(i=1;i<=5;i++)
{
ptr=(*list1);
for(j=1;j<=i;j++)
{
temp=ptr->info;
ptr=ptr->link;


}
ptr->info=x*temp + ptr->info;
}
}

Last edited by shabbir; 22Dec2009 at 10:18.. Reason: Code blocks
pseudobluz like this