Write a program to read two numbers from the keyboard and display the larger value on the screen



Write a program to read two numbers from the keyboard and display the larger value on the screen..

Answer / hr

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
float a,b;
cout<<" Enter two values :"<<endl;
cin>>a>>b;
if(a>b)
cout<<" larger value = "<<a<<endl;
else
cout<<" larger value = "<<b<<endl;
return 0;
}
OUTPUT:
Enter two values:10 20
Larger value:20

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C++ Interview Questions

How to input string in C++

0 Answers  


What are pass by value and pass by reference?what is the disadvantage of pass by value?

0 Answers   Alter,


what do you mean by exception handling in C++?

0 Answers   Alter,


How does stack look in function calls? Write a recursive function call, how will the stack look like?

0 Answers   Adobe,


What is the difference between an ARRAY and a LIST in C++?

0 Answers   IBS, TCS,






Without using third variable write a code to swap two numbers.

0 Answers   Accenture,


Define namespace.

1 Answers  


When would you use a pointer? A reference?

0 Answers   Amazon,


What is latest update of C++ ?

0 Answers   Adobe,


Write a program to display the following output using a single cout statement Maths=90 Physics=77 Chemistry = 69

2 Answers  


Discuss the role of C++ shorthands.

0 Answers   Adobe,


Write a program to read the values a, b and c and display x, where x=a/b–c. Test the program for the following values: (a) a = 250, b = 85, c = 25 (b) a = 300, b = 70, c = 70

1 Answers  


Categories