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 a program that will print %d in the output screen??
write C code to reverse a string such that if i/p is "abc defg hij klmno pqrs tuv wxyz" and the o/p should be "cba gfed jih onmlk srqp vut zyxw"
who is the father of C Language?
20 Answers CTS, UST,
char ch="{'H','I',0};printf("%s",ch);what is output
Tell me when would you use a pointer to a function?
Explain the array representation of a binary tree in C.
What do you mean by c what are the main characteristics of c language?
What is variable in c with example?
Can static variables be declared in a header file?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
Taking an example,differentiate b/w loader and linker ?
consider the following structure: struct num nam{ int no; char name[25]; }; struct num nam n1[]={{12,"Fred"},{15,"Martin"},{8,"Peter"},{11,Nicholas"}}; ..... ..... printf("%d%d",n1[2],no,(*(n1 + 2),no) + 1); What does the above statement print? a.8,9 b.9,9 c.8,8 d.8,unpredictable value