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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }

700


What is else if ladder?

607


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

646


What are the advantages and disadvantages of a heap?

710


What type is sizeof?

587






In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

1633


Why #include is used in c language?

599


When a c file is executed there are many files that are automatically opened what are they files?

594


How can I direct output to the printer?

812


‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .

2372


Give me the code of in-order recursive and non-recursive.

886


What are examples of structures?

597


Why can’t we compare structures?

814


Explain how do you print only part of a string?

650


What is a constant and types of constants in c?

603