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

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the role of && operator in a program code?

566


Which control loop is recommended if you have to execute set of statements for fixed number of times?

809


How would you obtain the current time and difference between two times?

727


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

660


Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

1520






What does typedef struct mean?

658


What are the types of functions in c?

570


How can I recover the file name given an open stream?

553


Explain 'far' and 'near' pointers in c.

706


Linked lists -- can you tell me how to check whether a linked list is circular?

646


What is #error and use of it?

681


What is c language & why it is used?

577


What does it mean when a pointer is used in an if statement?

600


How can you determine the size of an allocated portion of memory?

741


Do you have any idea about the use of "auto" keyword?

662