biggest of two no's with out using if condition statement

Answers were Sorted based on User's Feedback



biggest of two no's with out using if condition statement..

Answer / sarvanm

#include <stdio.h>
#include <math.h>
void main()
{
int m1,m2,a,b;
clrscr();
printf("Enter the First Number\n");
scanf("%d",&a);
printf("Enter the Second Number\n");
scanf("%d",&b);
m1=abs((a+b)/2);
m2=abs((a-b)/2);
printf("The Bigest No is==%d\n",m1+m2);
printf("The Smallest No is==%d\n",m1-m2);
}

Is This Answer Correct ?    15 Yes 1 No

biggest of two no's with out using if condition statement..

Answer / ansh

Use tenary operator..

c=a<b?b:a;

Is This Answer Correct ?    7 Yes 2 No

biggest of two no's with out using if condition statement..

Answer / deepshree sinha

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,m;
printf('enter any two numbers");
scanf("%d %d",&a,&b);
m=(a>b)?a:b;
printf("m=%d",m);
getch();
}

Is This Answer Correct ?    2 Yes 0 No

biggest of two no's with out using if condition statement..

Answer / ramanjaneyareddy

#include<stdio.h>
main()
{int a,b,c;
scanf("%d%d",&a,&b);
c=(a>b)?a:b;
printf("%d",c);
return(0);
}

Is This Answer Correct ?    2 Yes 3 No

biggest of two no's with out using if condition statement..

Answer / shafi.shaik

main()
{
int a,b;
a=10;
b=20;
clrscr();
if(a/b)
printf("A is Biggest");
if(b/a)
printf("B is Biggest");
getch();
}

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C Interview Questions

Tell us the use of fflush() function in c language?

0 Answers  


mplementation of stack using any programing language

1 Answers   Marlabs,


Write a C program to print 1 2 3 ... 100 without using loops?

15 Answers   Hindalco,


The file stdio.h, what does it contain?

0 Answers  


Explain what is the difference between far and near ?

0 Answers  






what is the purpose of the code, and is there any problem with it. bool f( uint n ) { return (n & (n-1)) == 0; }

1 Answers   Google,


how to create c progarm without void main()?

1 Answers   NIIT,


how to find your architecture is LittleEndian or BigEndian?

1 Answers  


What does & mean in scanf?

0 Answers  


what are two kinds of java

2 Answers  


2. Counting in Lojban, an artificial language developed over the last fourty years, is easier than in most languages The numbers from zero to nine are: 0 no 1 pa 2 re 3 ci 4 vo 5 mk 6 xa 7 ze 8 bi 9 so Larger numbers are created by gluing the digit togather. For Examle 123 is pareci Write a program that reads in a lojban string(representing a no less than or equal to 1,000,000) and output it in numbers.

3 Answers   Nagarro,


what is the function of .h in #include<stdio.h> in c ?

23 Answers   HCL, IBM, Wipro,


Categories