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

In C++ what is a vtable and how does it work?

0 Answers   Agilent,


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

2 Answers   Wipro,


What is pass by value & reference.

0 Answers   Accenture,


What is placement new?

1 Answers   Amazon,


What is conversion constructor in C++

0 Answers   TCS,






Discuss about iteration statements in C++ .

0 Answers   Agilent,


How to invoke a C function using a C++ program?

0 Answers   Alter,


Define an Abstract class in C++?

0 Answers  


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

0 Answers   Adobe,


Write a C++ Program to Find Sum and Average of n numbers using for loop.

1 Answers  


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

1 Answers  


Discuss the role of C++ shorthands.

0 Answers   Adobe,


Categories