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

Consider the following C++ program

0 Answers  


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

1 Answers  


Can we use THIS Pointer in static function – Reason in C++?

0 Answers  


What Is A Default Constructor in C++ ?

0 Answers   Amazon,


What is a class in C++?

0 Answers   Amazon, TCS, UGC Corporation,






What is a COPY CONSTRUCTOR and when is it called?

0 Answers   IBS,


Is there a difference between class and struct?

0 Answers  


what is a pragma in C++?

0 Answers   Aspire,


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

0 Answers  


Tell me about virtual function

1 Answers  


Define type casting in C++.

0 Answers   Amdocs,


Write a C++ Program to Display Number (Entered by the User).

1 Answers  


Categories