no of -ve elem in array

 #include <stdio.h>


int main() {

    // Write C code here

    int counter = 0;

    int arr[10];

    for (int i = 0 ; i<10 ; i++){

        printf("Enter %d element : ", i );

        scanf("%d",&arr[i]);

    }

    for (int i = 0 ; i<10 ; i++){

        if (arr[i]<0){

            counter = counter + 1;

        }

        else {

            counter = counter + 0 ;

        }

    }

    printf(" no of -ve ele are %d", counter);


   

    

    return 0;

}

Comments

Popular posts from this blog

Sum of Even Numbers till N

Find the Runner-Up Score!

Print All Substrings