English, asked by ritatyagi4644, 1 month ago

A company wishes to provide cab service fortheir N employees. The employees have IDsranging from 0 to N-1. Thompany hascalculated the total distance from anemployee's residence to the company,considering the path to be followed by the cabis a straight path. The distance of the companyfrom itself is 0. The distance for the employeeswho live to the left side of the company isrepresented with a negative sign. The distancefor the employees who live to the right side ofthe company is represented with a positivesign. The cab will be allotted a range ofdistance. The company wishes to find thedistance for the employees who live within theparticular distance range,Write an algorithm to find the distance for theemployees who live within the distance range,​

Answers

Answered by gangasaiganesh
5

the first line of the input consist of an integer-num, representing the size of the list(N).

The second line consists of N space separated integer representing the distance of the employees from the company.

The third line consists of an integer-/start, representing the starting value of the range the last line consists of the integer-end , representing the ending value of the range

Answered by niikiii
0

Answer:

Explanation:

#include<stdio.h>

int main()

{

   int n,r1,r2;

   scanf("%d %d %d",&n,&r1,&r2);

   int a[n],i,t;

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

   {

       scanf("%d",&a[i]);

       if(a[i]<0)

           t=-a[i];

       else

           t=a[i];

       if(t>=r1 && t<=r2)

           printf("%d ",a[i]);

   }

   return 0;

}

Similar questions