Answer:
// here is code in c++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{ // variable to store number of loads
int n;
cout<<"enter the number of servers:";
// read the number of servers
cin>>n;
// create an integer array of servers of size n
int server_load[n];
// read the load of each server
cout<<"enter the loads on each server:"<<endl;
for(int x=0;x<n;x++)
{
cin>>server_load[x];
}
// sort the array
sort(server_load,server_load+n);
int min_diff=MAX_INT;
// find the minimum absolute difference between the server load
for(int y=0;y<n-1;y++)
{
int d=server_load[y+1]- server_load[y];
if(d<min_diff)
min_diff=d;
}
// print the minimum difference
cout<<"minimum absolute difference of server load is: "<<min_diff<<endl;
return 0;
}
Explanation:
Read the number of servers from user and assign it to "n".Create an integer Array of size n to store the load on each server.Read the load of each server and store in the array. Sort the array. Then find the minimum difference between two load of servers. Print the minimum difference.
Output:
enter the number of servers:6
enter the loads on each server:
12 45 5 9 3 24
minimum absolute difference of server load is: 2
To slide your screen or to lock it or sort it
Answer:
Easy peasy, if you open Microsoft word and you click up at the top and you click the symbol as shown in A, then you click on inserted tab it will show up as B which is → symbol
So the answer is B →.
Answer:
endl
Explanation:
Note that endl must be free of quotation marks; otherwise, the program will treat it as a string.. The \n Character. The other way to break a line in C++ is to use the newline character