Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the value of a[3] if integer a[] = {5,4,3,2,1}?

1049


Can you assign a different address to an array tag?

1124


Multiply an Integer Number by 2 Without Using Multiplication Operator

728


What are the differences between new and malloc in C?

1085


What does #pragma once mean?

1118


How can I find the modification date of a file?

1229


which is conditional construct a) if statement b) switch statement c) while/for d) goto

1174


Write a program to print numbers from 1 to 100 without using loop in c?

1037


What is the basic structure of c?

1023


What are the difference between a free-standing and a hosted environment?

1235


Write a code on reverse string and its complexity.

991


How can I find the modification date and time of a file?

1045


What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.

2214


What header files do I need in order to define the standard library functions I use?

1011


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

1063