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 is the use of a semicolon (;) at the end of every program statement?

786


What are the 3 types of structures?

580


Explain how can type-insensitive macros be created?

579


Why is c used in embedded systems?

619


How do you override a defined macro?

709






What is the process to create increment and decrement stamen in c?

591


the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b

1917


Difference between malloc() and calloc() function?

661


Differentiate Source Codes from Object Codes

832


Explain what are preprocessor directives?

635


Explain what is the difference between far and near ?

657


what is the diffrenet bettwen HTTP and internet protocol

1397


What is difference between static and global variable in c?

544


What is the difference between text files and binary files?

683


Differentiate between the expression “++a” and “a++”?

712