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

How to create struct variables?

584


In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none

705


write a c program in such a way that if we enter the today date the output should be next day's date.

1677


What would be an example of a structure analogous to structure c?

570


What are directives in c?

537






How can I manipulate individual bits?

599


define string ?

660


Can you explain the four storage classes in C?

635


What is operator promotion?

619


What does %2f mean in c?

671


2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier.  Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed.  When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed.  Sequence of take-off is the sequence of addition to the waitlist

2511


Explain what is #line used for?

601


Differentiate call by value and call by reference?

560


Why double pointer is used in c?

560


What are the data types present in c?

617