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. Note: Use dynamic memory allocation
Answers
Answered by
0
Answer:
Dynamic memory allocation
Explanation:
In the above question,we are given that 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.
#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;
}
Hence solved
Similar questions