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 / abin m devasia,biju k m

#include<iostream.h>
void main()
{
int a,b,c;
cin>>a>>b;
c=abs(a-b);
c=(a+b+c)/2;
cout<<"Big is"<<c;
}

Is This Answer Correct ?    18 Yes 1 No

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

Answer / abhilash.d

void main()
{
int a,b,big;
printf("enter the values of a,b");
scanf("%d%d",&a,&b);
big=a>b?a:b;
printf("biggest of two no is:%d",big);
}

Is This Answer Correct ?    19 Yes 7 No

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

Answer / saravanan marimuthuraja

#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 ?    9 Yes 2 No

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

Answer / jasna.c

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,big;
printf("\nEnter the two numbers ");
scanf("%d%d",&a,&b);
big=(a>b)?a:b;
printf("\n The biggest number is %d",big);
getch();
}

Is This Answer Correct ?    4 Yes 4 No

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

Answer / saravanan marimuthuraja

#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 ?    4 Yes 4 No

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

Answer / k.anand

#define myabs(a,b) a>b?(a-b):(b-a)
int main()
{
int a,b;
int biggest=0;
scanf("%d%d",&a,&b);
biggest=(a+b+myabs(a,b))/2;
printf("%d",biggest);


}

Is This Answer Correct ?    6 Yes 7 No

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

Answer / agalya

#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=max(a,b);
m2=min(a,b);
printf("The Bigest No is==%d\n",m1);
printf("The Smallest No is==%d\n",m1);
}

Is This Answer Correct ?    2 Yes 3 No

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

Answer / partheeban

void main()
{
float i,j;
int a;
printf("Enter two numbers : ");
scanf("%f%f",&i&j);
a=i/j;
if(a)
printf("%f is greater",i);
else
printf("%f is greater",j);
}

Is This Answer Correct ?    2 Yes 9 No

Post New Answer

More C Interview Questions

What is structure padding ?

3 Answers   HP,


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

0 Answers  


What is volatile keyword in c?

0 Answers  


1.What is a Data Structure? Explain its need? 2.What is a Directed Graph? Write an algorithm to find whether a Directed Graph is connected or not? 3.Explain the process of converting a Tree to a Binary Tree.

4 Answers   Ignou, TCS,


Is void a keyword in c?

0 Answers  






The C language terminator is a.semicolon b.colon c.period d.exclamation mark

6 Answers   TCS,


define switch statement?

6 Answers   CTS,


Explain how are portions of a program disabled in demo versions?

0 Answers  


Explain how can I pad a string to a known length?

0 Answers  


I didn't count the ducks that I saw in line, but I do remember that one duck was in front of two ducks, another duck behind two ducks. How many ducks did I see?

2 Answers  


What are extern variables in c?

0 Answers  


What are dangling pointers? How are dangling pointers different from memory leaks?

1 Answers  


Categories