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 the value of a[3] if integer a[] = {5,4,3,2,1}?
Can you assign a different address to an array tag?
Multiply an Integer Number by 2 Without Using Multiplication Operator
What are the differences between new and malloc in C?
What does #pragma once mean?
How can I find the modification date of a file?
which is conditional construct a) if statement b) switch statement c) while/for d) goto
Write a program to print numbers from 1 to 100 without using loop in c?
What is the basic structure of c?
What are the difference between a free-standing and a hosted environment?
Write a code on reverse string and its complexity.
How can I find the modification date and time of a file?
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
What header files do I need in order to define the standard library functions I use?
cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration