#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
struct A {
int a;
struct A *next;
} ;
struct A * create(struct A *head){
struct A * p1,*p2;
p1=(struct A *)malloc(sizeof(struct A));
p2=(struct A *)malloc(sizeof(struct A));
for(int i=0;i<13;i++){
if(i==0){
head=p1;
}else{
p1->a=i;
p2->next=p1;
p2=p1;
p1=(struct A *)malloc(sizeof(struct A));
}
}
p2->next=NULL;
return head;
}
void del(struct A * head){
struct A *p1,*p2;
p1=head;
p2=(struct A *)malloc(sizeof(struct A));
while(p1->next!=NULL){
p2=p1;
p1=p1->next;
if(p1->a%3==0){
p2->next=p1->next;
}
}
}
void show(struct A *head){
struct A *p=(struct A *)malloc(sizeof(struct A));
p=head;
do{
printf("%d ",p->a);
p=p->next;
}while(p!=NULL);
}
int main() {
struct A * head=(struct A *)malloc(sizeof(struct A));
head=create(head);
show(head);
del(head);
show(head);
}