9. After the holidays lots of people were rushing to move back to their apartments. In this scenario, even numbers will represent women while odd numbers will represent men. Store the sequence of entry into the building by typing in even and odd numbers into an array at random. Calculate the largest sequence of women entering the building before a man enters. (The largest continuous number of women that entered before a man came in) Example: 17, 4, 6, 8, 9, 2, 8, 49 (The largest continuous number of women is 3).

PHOTO EMBED

Fri Aug 18 2023 19:34:41 GMT+0000 (Coordinated Universal Time)

Saved by @Codes

// Online C compiler to run C program online
#include <stdio.h>

int main() {
   int size;
   printf("Enter the size of the array: ");
   scanf("%d",&size);
   int apart[size];
   int count = 0;
   for(int i = 0; i < size; i++){
       printf("Element - %d: ",i+1);
       scanf("%d",&apart[i]);
   }
   for(int i = 0; i < size; i++){
       if(apart[i]%2==1){
           count++;
       }
       else{
           continue;
       }
   }
   printf("The largest continuous number of women is %d",count);

    return 0;
}
content_copyCOPY