Will mark you brainliest if you help. If you do not know please ignore. Computer [Arrays]
Write a Java program to accept names of 5 students and their total marks in the final examination, in two different single dimensional arrays. Use the Bubble sort method to arrange the name list as per the rank list. Display the resultant sorted array and the name of the top scorer.
Answers
Answer:
// CPP implementation of above approach
#include<bits/stdc++.h>
using namespace std;
// Function to find sum
// of array exlcuding the
// range which has [a, b]
void sumexcludingrange(vector<int>li, int a, int b)
{
int sum = 0;
bool add = true;
// loop in li
int n = li.size();
for (int i = 0;i < n; i++)
{
// if no != a then add
if (li[i] != a &&
add == true)
sum = sum + li[i];
// mark when a
// and b are found
else if (li[i] == a)
add = false;
else if( li[i] == b)
add = true;
}
// print sum
cout<<(sum);
}
// Driver Code
int main()
{
vector<int>lis{1, 2, 4, 5, 6};
int a = 2;
int b = 5;
sumexcludingrange(lis, a, b);
}
// This code is contributed by