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

Write a program in c to replace any vowel in a string with z?

0 Answers   IBS,


What does double pointer mean in c?

0 Answers  


Which of the following about automatic variables within a function is correct ? a.its type must be declared before using the variable b.they are local c.they are not initialised to zero d.they are global.

6 Answers   FCI, TCS,


wats SIZE_T meant for?

1 Answers  


Write a program that receives as input a number omaadel-n-print, four digits.

0 Answers  






What is pointers in c with example?

0 Answers  


what is the difference between c and c++?

7 Answers  


Why doesn't C have nested functions?

2 Answers  


What is the difference between char a[] = "string"; and char *p = "string"; ?

14 Answers   Adobe, Honeywell, TCS,


Explain what is the difference between #include and #include 'file' ?

0 Answers  


What is a stream water?

0 Answers  


write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

0 Answers  


Categories