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 |
C program to find frequency of each character in a text file?
What does %d do in c?
program to find the second largest word in a paragraph amongst all words that repeat more thn twice
What does sizeof function do?
What do you mean by a sequential access file?
What is the use of gets and puts?
Hi, main() { } Is a user defined function or Built in Functionn
Which of the following data structures is on average the fastest for retrieving data: 1) Binary Tree 2) Hash Table 3) Stack
What is non linear data structure in c?
wat is the output int main() { char s1[]="Hello"; char s2[]="Hello"; if(s1==s2) printf("Same"); else printf("Diff"); }
When a c file is executed there are many files that are automatically opened what are they files?
What is the equivalent code of the following statement in WHILE LOOP format?