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

What is latest update of C++ ?

0 Answers   Adobe,


Tell us the size of a float variable.

0 Answers   Accenture,


How to convert integer to string in C++

0 Answers  


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 RTTI and why do you need it?

0 Answers   Amazon,


Explain encapsulation in C++.

0 Answers   Verifone,


What is the difference between public, private, and protected inheritance?

0 Answers   Amazon,


write a program To generate the Fibonacci Series.

0 Answers   Accenture,


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

1 Answers   IBS, TCS,


What Are The Differences Between A C++ Struct And C++ Class?

2 Answers   Wipro,


What are the advantages/disadvantages of using inline and const?

0 Answers   Amazon,


What is a COPY CONSTRUCTOR and when is it called?

0 Answers   IBS,


Categories