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

Post New Answer

More C++ Interview Questions

Identify the error in the following program. #include<iostream.h> void main() { int i = 0; i = i + 1; cout « i « " "; /*comment *//i = i + 1; cout << i; }

1 Answers  


To solve the 8 Queens problem, which algorithm is used?

0 Answers   Accenture,


What is RTTI and why do you need it?

0 Answers   Amazon,


How to delete array of objects in C++? Proof by C++ code for proper deletion

0 Answers  


Factory Method C++ – How to delete pointers returned by it

0 Answers  


What is Copy Constructor?

5 Answers   ABC, Siemens,


Identify the error in the following program. include<iostream> using namespace std; void main() { int num[]={1,2,3,4,5,6}; num[1]==[1]num ? cout<<"Success" : cout<<"Error"; }

1 Answers  


What is name mangling/name decoration?

0 Answers   Amazon,


How can a C function be called in a C++ program?

0 Answers  


Find the Factorial of a number using a program.

0 Answers   Accenture,


Write a C++ Program to Find Sum and Average of three numbers.

1 Answers  


How to reverse a string in C++

0 Answers  


Categories