write a program to find the largest of two numbers without
using for,while,switch,if else, conditional operator and do
while using c++ pgmng language

Answers were Sorted based on User's Feedback



write a program to find the largest of two numbers without using for,while,switch,if else, conditi..

Answer / random

double largest(double x, double y){
return (x+y)/2. + abs(x-y)/2.;
}

Is This Answer Correct ?    28 Yes 9 No

write a program to find the largest of two numbers without using for,while,switch,if else, conditi..

Answer / vishal sharma

double largeone(double a,double b)
{
return(((a+b)/2) + ((a-b)/2));
}

Is This Answer Correct ?    9 Yes 2 No

write a program to find the largest of two numbers without using for,while,switch,if else, conditi..

Answer / swaroop

int max,a,b;
max = (a>b)? a:b ;

Is This Answer Correct ?    8 Yes 10 No

Post New Answer

More OOPS Interview Questions

What does the code "cout<<(0==0);" print? 1) 0 2) 1 3) Compiler error: Lvalue required

15 Answers   ISTS, Wipro,


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.

1 Answers  


Why do while loop is used?

0 Answers  


#include <string.h> #include <stdio.h> #include <stdlib.h> #include<conio.h> void insert(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); insert(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void insert(char *items, int count) { register int a, b; char t; for(a=1; a < count; ++a) { t = items[a]; for(b=a-1; (b >= 0) && (t < items[b]); b--) items[b+1] = items[b]; items[b+1] = t; } } design an algorithm for Insertion Sort

0 Answers  


What is multiple inheritance? Give Example

6 Answers   Mind Tree,






What is class encapsulation?

0 Answers  


How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?

1 Answers   IntraLogic,


What is abstraction in oop with example?

0 Answers  


What do we mean by a hidden argument in a function?

1 Answers   TCL,


What do you mean by abstraction?

0 Answers  


What is the highest level of cohesion?

0 Answers  


What is class in oop with example?

0 Answers  


Categories