Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
84 views
in Arrays by (29.6k points)
closed by

Collect the heights of 12 students from your class in which 7 students are male and others are female students. Suppose these male and female students be seated in two separate benches and you are given a place which is used for sitting these 12 students in linear form. How will you combine and make them sit without mixing male/female students. Write a program for the same.

1 Answer

+1 vote
by (29.8k points)
selected by
 
Best answer

#include<iostream>

using namespce std;

int main()

{

int i,j,m[7],f[5],mf[12],t;

for (i=0;i<7;i++)

{

cout<<"Enter the height of male student"<<i+1<<":";

       cin>>m[i];

}

for (i=0;i<5;i++)

 {

  cout<<"Enter the height of female student"<<i+1<<":";

cin>>f[i];

}

for (i=0;i<6; i++)

for (j=0;j<6-i:j++)

   if (m[j]>m[j+1])

    {

     t=m[j];

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

...