write a c program for greatest of three numbers without
using if statment

Answers were Sorted based on User's Feedback



write a c program for greatest of three numbers without using if statment..

Answer / sathishmani

void main()
{
int a=10,b=20,c=30,d;
d=((a>b)&&(a>c))?1:2;
switch(d)
{
case 1:
printf("%d",a);
break;
case 2:
d=(b>c)?b:c;
printf("%d",d);
break;
}
}

Is This Answer Correct ?    68 Yes 21 No

write a c program for greatest of three numbers without using if statment..

Answer / swathi

main()
{
int a,b,c,s1,big;
printf("enter 3 values");
scanf("%d %d %d", &a,&b,&c);
s1=(a>b)? a : b;
big= (s1>c)? s1 : c;
printf("largest of 3 no's=%d",big);
}

Is This Answer Correct ?    23 Yes 6 No

write a c program for greatest of three numbers without using if statment..

Answer / ragu

int call();
void main()
{
int a,b,c,d;
printf("enter the values");
scanf("%d%d%d",&a,&b,&c);
d=call();
}
call()
{
return(a>b?a>c?a:c:b>c?b:c);
}

Is This Answer Correct ?    28 Yes 19 No

write a c program for greatest of three numbers without using if statment..

Answer / suresh

main()
{
int a,b,c,big;
printf("enter 3 values");
scanf("%d %d %d", &a,&b,&c);
big= ((a>b)&&(a>c))? a :b>c?b:c;
printf("largest of 3 no's = %d",big);
}

Is This Answer Correct ?    6 Yes 2 No

Post New Answer

More C Interview Questions

What are called c variables?

0 Answers  


What is #include called?

0 Answers  


what are two categories of clint-server application development ?

1 Answers  


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

0 Answers  


how can i get the output 54321 4321 321 21 1 in c programming........???? pls help......

10 Answers   Infosys,






What are high level languages like C and FORTRAN also known as?

0 Answers  


Explain how can a program be made to print the name of a source file where an error occurs?

0 Answers  


Explain how do you use a pointer to a function?

0 Answers  


Please list all the unary and binary operators in C.

3 Answers  


Explain what is the difference between null and nul?

0 Answers  


Explain zero based addressing.

0 Answers  


An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?

0 Answers   Aspire, Infogain,


Categories