#include<stdio.h>
#include<stdlib.h>
struct node{
   int data;/* data */
   struct node* link;
};
void count_of_negative_data(struct node *head);
void count_of_positive_data(struct node *head);
int main(){
    struct node *head = malloc(sizeof(struct node));
    head->data= 7;
    head->link= NULL;

    struct node *now = malloc(sizeof(struct node));
    now->data = 9;
    now->link= NULL;
    head->link= now;

    struct node *last = malloc(sizeof(struct node));
   now->data = 11;
   now->link = NULL;
   head->link->link = last;

    count_of_negative_data(head);
    printf("\n");
    count_of_negative_data(head);
    return 0;
}
void count_of_negative_data(struct node *head){
    int count = 0;
    if(head == NULL){
        printf("data not found");

    }
    struct node *ptr = NULL;
    ptr = head;
    while(ptr != NULL){
        if(ptr->data < 0){
            count++;
        }
        ptr = ptr->link;
    }
    printf("%d", count);
}
void count_of_positive_data(struct node *head){
    int count = 0;
    if(head == NULL){
        printf("data not found");

    }
    struct node *ptr = NULL;
    ptr = head;
    while(ptr != NULL){
       if(ptr->data > 0){
            count++;
        }
        ptr = ptr-> link;
    }
    printf("%d", count);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: