Math, asked by Dixant5324, 9 months ago

4) write a pair of integers whose product is -12 and there lies seven integers between them(excluding the given integers)

Answers

Answered by rishika79
0

Answer:

Step-by-step explanation:

Assuming x≤y

Number of integers = max(0,⌈y⌉−⌊x⌋−1)

In short, push x down to the nearest integer and y up to the nearest integer. The difference between these integers is one more than the number of integers between. The max() function takes care of the instance where x=y and x,y∈Z, which would result in −1.

Hope it helps you...

Answered by 45mehul
0

first sort the array in nlgn and then its easy just take two pointers one pointing ats start index of array and one at the end of the array and start checking sum

like this

whwrw a is the integer array givcen

int *p;

int *q;

p=a;

q=a+n-1;

while(p!=q)

{

if(*p+*q==sum)

{printf("(%d,%d)\n",*p,*q);

p++;

q--;

continue;}

if(*p+*q<sum)

{

p++;

continue;

}

q--;

}

Similar questions