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

with out using main how to execute the program?

2 Answers  


write a program to create a sparse matrix using dynamic memory allocation.

0 Answers  


What is variable in c with example?

1 Answers  


Why cant I open a file by its explicit path?

0 Answers  


what type of questions arrive in interview over c programming?

0 Answers  






Explain output of printf("Hello World"-'A'+'B'); ?

0 Answers  


Write an algorithm for a program that receives an integer as input and outputs the product of of its digits. E.g. 1234 = 24, 705 = 0

4 Answers  


How are structure passing and returning implemented?

0 Answers  


Explain is it valid to address one element beyond the end of an array?

0 Answers  


Explain how do you declare an array that will hold more than 64kb of data?

0 Answers  


What is d scanf?

0 Answers  


write a program to add two numbers of any size.....(remember any size)

1 Answers  


Categories