Write a C program to find the smallest of three integers,
without using any of the comparision operators.
Answer Posted / n r sree harsha
#include<stdio.h>
#include<math.h> /* for using abs() function */
main()
{
int a,b,c,small;
printf("\n enter numbers");
scanf("%d%d%d",&a,&b,&c);
if(abs(a-b)-(a-b))
{
if(abs(a-c)-(a-c))
{
s=a;
else
s=c;
}
else
{
if(abs(b-c)-(b-c))
{
s=b;
else
s=c;
}
}
printf("\n small=%d",s);
}
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
Why is it usually a bad idea to use gets()? Suggest a workaround.
What do you mean by command line argument?
When the macros gets expanded?
Why is structure padding done in c?
Can you return null in c?
explain how do you use macro?
show how link list can be used to repersent the following polynomial i) 5x+2
How can you be sure that a program follows the ANSI C standard?
in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above
What are predefined functions in c?
How can a number be converted to a string?
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
Why do we need volatile in c?
Which programming language is best for getting job 2020?