Program to find largest of three numbers without using comparsion operator?

Answers were Sorted based on User's Feedback



Program to find largest of three numbers without using comparsion operator?..

Answer / a.naga tirupathi rao

#include <stdio.h>
#include <conio.h>
main()
{
int a[i],sum=0,i,j;
for(i=1;i<=3;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
for(j=sum;j<=sum;j--)
{
for(i=1;i<=3;i++)
{
if(j==a[i])
{
printf("%d is biggest",j);
break;
}
}
}
getch();
}

Is This Answer Correct ?    4 Yes 1 No

Program to find largest of three numbers without using comparsion operator?..

Answer / sanjay bhosale

Both programs mentioned above produce wrong results when some numbers are positive and others are negatives.

Is This Answer Correct ?    0 Yes 0 No

Program to find largest of three numbers without using comparsion operator?..

Answer / arunslb123

ct=0;
while(var1 && var2 && var3){
var1++;
var2++;
var3++;
ct--;
}
printf("%d",ct);

could u pls explain this

Is This Answer Correct ?    5 Yes 6 No

Post New Answer

More C Interview Questions

C program to find frequency of each character in a text file?

6 Answers  


What does %d do in c?

0 Answers  


program to find the second largest word in a paragraph amongst all words that repeat more thn twice

4 Answers   CTS, iGate,


What does sizeof function do?

0 Answers  


What do you mean by a sequential access file?

0 Answers  


What is the use of gets and puts?

0 Answers  


Hi, main() { } Is a user defined function or Built in Functionn

26 Answers   Honeywell, Yahoo,


Which of the following data structures is on average the fastest for retrieving data: 1) Binary Tree 2) Hash Table 3) Stack

3 Answers  


What is non linear data structure in c?

0 Answers  


wat is the output int main() { char s1[]="Hello"; char s2[]="Hello"; if(s1==s2) printf("Same"); else printf("Diff"); }

3 Answers  


When a c file is executed there are many files that are automatically opened what are they files?

0 Answers  


What is the equivalent code of the following statement in WHILE LOOP format?

0 Answers  


Categories