Computer Science, asked by piyushhiwanj, 1 month ago

A cloud computing company can
accommodate various requirements for
resources. The company system runs two
servers. For load balancing purposes, the load
of the resources gets transferred to the servers
one by one. Initially, the first request goes to
server 1, the next request goes to server 2. and
so on. The requests served by the servers are
of two types i.e. one for memory
allocation(denoted by a positive rumber).and
the other for memory dea location (derored by
a negative number).​

Answers

Answered by Suryakant5153
23

Answer:

C++

#include<iostream>

using namespace std;

int main()

{

  int n,c=0,sum=0;

  cin>>n;

  int a[n];

  for(int i=0;i<n;i++)

  cin>>a[i];

  for(int i=0;i<n;i=i+2)

  sum=sum+a[i];

  cout<<sum;

   return 0;

}

Explanation:

Answered by AditiHegde
3

Write a C++ program using the given details.

Given.

Two servers.

load transferred to the servers.

load of the resources gets transferred to the servers.

The first request goes to server 1.

The next request goes to server 2.

two types of request servers.

1 for memory allocation(+ve).

1 for memmory deallocation(-ve).

To find.

write a C++ program using the given details.

Solution.

#include<iostream>

using namespace std;

int main()

{

 int n,c=0,sum=0;

 cin>>n;

 int a[n];

 for(int i=0;i<n;i++)

 cin>>a[i];

 for(int i=0;i<n;i=i+2)

 sum=sum+a[i];

 cout<<sum;

  return 0;

}

#SPJ2

Similar questions