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
What is structure padding and packing in c?
When is the “void” keyword used in a function?
C language questions for civil engineering
Why is C language being considered a middle level language?
What does d mean?
What is mean by data types in c?
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10
What language is c written?
Can main () be called recursively?
Explain modulus operator. What are the restrictions of a modulus operator?
Do you know the use of 'auto' keyword?
What is %lu in c?
what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?
Explain how do you determine the length of a string value that was stored in a variable?
Explain what is a 'locale'?