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
When should the register modifier be used? Does it really help?
What are the advantages of using macro in c language?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
What is getch() function?
What functions are used for dynamic memory allocation in c language?
What is a substring in c?
Are enumerations really portable?
Why c is faster than c++?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics
What is the use of pointers in C?
Is c a great language, or what?
What is the use of bit field?
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given
What is the difference between printf and scanf )?