Program to find largest of three numbers without using comparsion operator?
Answers were Sorted based on User's Feedback
#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 |
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 |
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 |
write an algorithm which can find the largest number among the given list using binary search ............... this was asked in the interview
2 Answers Satyam, UNIS, Wipro,
What is variable declaration and definition in c?
what are the languages used in c#?
Explain what is a program flowchart and explain how does it help in writing a program?
How can I avoid the abort, retry, fail messages?
What is the use of extern in c?
What do you understand by normalization of pointers?
Explain how do you override a defined macro?
main() { static char *s[]={"black","white","yellow","voilet"}; char **ptr[]={s+3,s+2,s+1,s}, ***p; p=ptr; **++p; printf("%s",*--*++p+3); }
i want to make a program in which we use input having four digits(4321) and get output its reciprocal(1234).
Write a small C program to determine whether a machine's type is little-endian or big-endian.
How many types of operators are there in c?