Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


write a c program to find biggest of 3 number without
relational operator?

Answers were Sorted based on User's Feedback



write a c program to find biggest of 3 number without relational operator?..

Answer / manjeeth

void main()
{
int a = 5;
int b = 7;
int c = 2;
int res;

res = (int)(a/b)?a:b;
res = (int)(res/c)?res:c;

printf("big num = %d",res);
}

Is This Answer Correct ?    132 Yes 28 No

write a c program to find biggest of 3 number without relational operator?..

Answer / abhishek

There is small mistake in "Kishore Kumar Naik" answer.

int main()
{
int nNum1, nNum2, nNum3;
int nRes,nSize, nBig;
nSize = sizeof(int) * 8;
printf("\nEnter 3 numbers");
scanf("%d%d%d", &nNum1, &nNum2, &nNum3);

nRes = nNum1 - nNum2;
nRes = nRes >> nSize -1;

nBig = nRes ? nNum2 : nNum1;

nRes = nBig - nNum3;
nRes = nRes >> nSize -1;

nBig = nRes ? nNum3 : nBig;

printf("big num = %d", nBig);
}

Is This Answer Correct ?    17 Yes 16 No

write a c program to find biggest of 3 number without relational operator?..

Answer / pankaj upadhyay

using c++;
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int a,b,c;
double d;
cout<<"enter no.";
cin>>a>>b;
d=pow(2,a-b)
c=(int)d;
if(c==0)
cout<<b;
else
cout<<a;
return 0;
}

Is This Answer Correct ?    3 Yes 2 No

write a c program to find biggest of 3 number without relational operator?..

Answer / abhishek agarwal

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("a=") ;
scanf("%d",&a);
printf("b=");
scanf("%d",&b);
while (a!=0&&b!=0)
{
a=a--;
b=b--;
if (a==0)
printf ("b is greater");
if (b==0)
printf("a is greater");
}
getch();
}

For more programs see my blog cblogabhishek.blogspot.com

Is This Answer Correct ?    19 Yes 19 No

write a c program to find biggest of 3 number without relational operator?..

Answer / raheman(papi)khan

#include<stdio.h>
void main()
{
int a,b,c;
printf("enter the value of a b and c");
scanf("%d%d%d",%a,&b,&c);
int max=a;
if(b>max)
max=b;
if(c>max)
max=c;
printf("%d",max);
else
printf("equal");
}

Is This Answer Correct ?    3 Yes 3 No

write a c program to find biggest of 3 number without relational operator?..

Answer / m. priyanga

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter the values a,b,c:");
scanf("%d%d%d",&a,&b,&c);
if((a>b)&&(a>c))
printf("a is greatest of %d %d %d",a,b,c);
else if(b>c)
printf("b is greatest of %d %d %d",a,b,c);
else
printf("c is greatest of %d %d %d",a,b,c);
getch();
}
Output:
Enter the values a,b,c: 4 5 6
c is greatest of 4 5 6

Is This Answer Correct ?    2 Yes 7 No

write a c program to find biggest of 3 number without relational operator?..

Answer / kishore kumar naik p

All above answers are wrong.

For "Manjeeth" answer, it does not work always, for example
a= -8, b = 2;
then
res = (int)(a/b)?a:b;
statement says a as big
res = (int)(-8/2)?-8:2;
res = in(-4)?-8:2
res = -8;

which is wrong.

The other two answers are using relational operators so it
does not answer the question. And finally the answer is

void main()
{
int nNum1, nNum2, nNum3;
int nRes,nSize, nBig;
nSize = sizeof(int) * 8;
printf("\nEnter 3 numbers");
scanf("%d%d%d", &nNum1, &nNum2, &nNum3);

nRes = nNum1 - nNum2;
nRes = nRes >> nSize -1;

nBig = nRes ? nNum1 : nNum2;

nRes = nBig - nNum3;
nRes = nRes >> nSize -1;

nBig = nRes ? nBig : nNum3;

printf("big num = %d", nBig);
}

Is This Answer Correct ?    18 Yes 26 No

write a c program to find biggest of 3 number without relational operator?..

Answer / keerthana

include<stdio.h>
include<conio.h>
void main()
int a,b,c;
clrscr();
printf("enter the three values:")
scanf("%d%d%d",&a,&b,&c)
if(a>b&a>c);
{
printf("a is big")
}
else
if (b>a&b>c)
{
printf("b is big")
}
else
printf("c is big");
getch();
}

Is This Answer Correct ?    6 Yes 19 No

write a c program to find biggest of 3 number without relational operator?..

Answer / zishan ahmad

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("enter the values of a,b and c");
scanf("%d%d%d",&a,&b,&c);
if(a>b && a>c)
printf("a is greatest of %d %d %d", a,b,c);
else
if(b>c)
printf("b is greatest of %d %d %d",a,b,c);
else
printf("c is gratest of %d %d %d",a,b,c);
getch();
}

Is This Answer Correct ?    1 Yes 15 No

write a c program to find biggest of 3 number without relational operator?..

Answer / rozzz

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
printf("nt Enter the first number : ");
scanf("%d",&a);
printf("nt Enter the second number : ");
scanf("%d",&b);
printf("nt Enter the third number : ");
scanf("%d",&c);
if(a>b && a>c)
printf("nt The greatest number is : %d ",a);
if(b>a && b>c)
printf("nt The greatest number is : %d ",b);
if(c>a && c>b)
printf("nt The greatest number is : %d ",c);
getch();
}

Is This Answer Correct ?    5 Yes 34 No

Post New Answer

More C Interview Questions

What are structure types in C?

0 Answers  


12345 1234 123 12 1

2 Answers  


What does emoji p mean?

0 Answers  


Write a C Programm.. we press 'a' , it shows the albhabetical number is 1, if we press 'g' it shows the answer 7.. any can help me

7 Answers  


What is the difference between break and continue?

3 Answers  


main() { int x=2, y=4 if ((x==2||y==4) x++ y++ if (y==4+1) { x=x+y; } y++; printf("The values of x and y are %d and %d."x,y); } What is the output?

5 Answers   TCS,


What is the difference between new and malloc functions?

0 Answers   InterGraph,


How do I declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

2 Answers   CMC, Wipro,


How to convert a binary number to Hexa decimal number?? (Note:Do not convert it into binary and to Hexadecimal)

1 Answers   iLantus, Subex,


Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?

0 Answers  


What is array in C

0 Answers  


value = 0xabcd; for (loop = 1; (value >> 1) & 1 | loop & 1; loop++) { foo(); if (loop & 1) value >>= 1; } how many times is foo() executed?

6 Answers   Google,


Categories