AR2
QUESTION DESCRIPTION
Kapil dev organized a team selection meeting.
He gave instructions to team selectors to review the performance of players name from last to first.
So the selectors has a problem to review all the names from the pool of names.
Now team selectors approached technical team to show the players ID in a reverse orger.
Now technial team members trying to write a Program to insert n integers in an array and print reverse of the array.
Now they were fixing the mandatory variable declarations as "int array[MAX], i, largest1, largest2"
Kapil dev organized a team selection meeting.
He gave instructions to team selectors to review the performance of players name from last to first.
So the selectors has a problem to review all the names from the pool of names.
Now team selectors approached technical team to show the players ID in a reverse orger.
Now technial team members trying to write a Program to insert n integers in an array and print reverse of the array.
Now they were fixing the mandatory variable declarations as "int array[MAX], i, largest1, largest2"
TEST CASE 2
INPUT
INPUT
6
2
1
4
8
7
2
OUTPUT2 7 8 4 1 2
#include <iostream>
using namespace std;
int main() {
int MAX;
cin>>MAX;
int array[MAX], i, largest1, largest2;
for(i=0;i<MAX;i++)
cin>>array[i];
largest1=array[0];
largest2=array[MAX-1];
cout<<largest2<<" ";
for(i=MAX-2;i>=1;i--)
{
cout<<array[i]<<" ";
}
cout<<largest1;
return 0;
}
Comments
Post a Comment