- Code: Select all
5 1
5 5 5 5 5
5
the output should be :
- Code: Select all
X X
Hope it Helps . . .
Moderator: Board moderators
5 1
5 5 5 5 5
5X X

5
5 5 5 5 5
1
5
if(!lower)
printf("%c ", 'X');
else
printf("%ld ", lower);
if(!higher)
printf("%c", 'X');
else
printf("%ld", higher);
nymo wrote:... anyway, I am getting P.E. on this problem, What is the expected format?
while (qn--) {
if(!lower)
printf("%c ", 'X');
else
printf("%ld ", lower);
if(!higher)
printf("%c", 'X');
else
printf("%ld", higher);
printf("\n");
}
4
1 4 5 7
4
4 6 8 10
1
1
1
1
3
1 3 3
2
1
3
5
5 5 5 5 5
1
5
output:
1 5
5 7
7 X
7 X
X X
X 3
1 X
X X



long b_src(long a[],long n,long x) //a[] is the array...it can be made global...
{ //n is the total elements....x is what i m looking for..
int ini,end,mid;
ini=0;
end=n-1;
while(ini<=end)
{
mid=(ini+end)/2;
if(x==a[mid])
return (mid);
else if(x>a[mid])
ini=mid+1;
else
end=mid-1;
}
return mid; //it always returns something (In case of binary search 'return 0')
}Users browsing this forum: No registered users and 0 guests