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 value of h?

580


What is the g value paradox?

632


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

1486


Is there anything like an ifdef for typedefs?

693


how should functions be apportioned among source files?

616






What is difference between class and structure?

561


What is calloc()?

617


What does a function declared as pascal do differently?

596


What is an identifier?

618


One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.

2148


Explain what does the function toupper() do?

626


Is null equal to 0 in sql?

640


What is 02d in c?

622


What is scope of variable in c?

549


What is null pointer constant?

588