Computer Science, asked by gayatrigangurde1999, 10 months ago

Sid Sriram's concert is going to happen by this week. Event coordinators have sold all tickets, odd number tickets are given to males and even number tickets are given to females. Finally, they need a count of males and females to allocate seats separately in the auditorium.

Answers

Answered by mayursanjaydeshmukh
19

Answer:

#include<iostream>

#include<cstdlib>

using namespace std;

int main(){

 int *p;

  int n,count,m;

 cin>>n;

 p=(int *)malloc(2* sizeof(int));

 for(int i=0;i<n;i++)

 {

 cin>> *(p + i);

 if(*(p+i)%2!=0)

 {

   count++;

 }

   else if(*(p+i)%2==0)

   m++;

 }

 cout<<count<<"\n"<<m;

 return 0;

}

Explanation:

All test cases are passed.

Answered by vanarasevaibhavi
6

Answer:

#include<iostream>

#include<cstdlib>

using namespace std;

int main(){

 int n,*ptr,m=0,w=0;

 cin>>n;

 ptr = (int*) malloc (n*sizeof(int));

 

 for(int i=0;i<n;i++)

   cin>>*(ptr+i);

 

 for(int i=0;i<n;i++)

 {  if(*(ptr+i)%2)

        m++;

  else

    w++;

 }

 cout<<m<<"\n"<<w;

 

       

 return 0;

}

Explanation:

all test cases are passed

Similar questions