how to find the largest element of array without using relational operater?

Answer Posted / upendra singh and avinash cho

#include<stdio.h>
#include<string.h>
void main()
{
int arr[4]={1,10,5,4},c,i,k,j=1;
k=arr[0];
for( i=0;i<3;i++)
{ c=k-arr[i+1];
c=c>>15;
if(c)
k=arr[i+1];
}
printf("largest number %d",k);
getch();
}

Is This Answer Correct ?    25 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are bit fields? What is the use of bit fields in a structure declaration?

1497


What is the advantage of c?

607


State the difference between x3 and x[3].

648


7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.

2215


What is calloc in c?

654






How can you increase the size of a dynamically allocated array?

637


What is the difference between union and structure in c?

567


find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }

1855


If I have a char * variable pointing to the name of a function ..

645


What is time complexity c?

562


How can I do graphics in c?

586


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

762


What does 3 mean in texting?

605


What is declaration and definition in c?

521


Is python a c language?

550