Here's the program to read two numbers from the keyboard and display the larger value on the screen: c++ Copy code #include <iostream> using namespace std; int main() { int num1, num2; cout << "Enter first number: "; cin >> num1; cout << "Enter second number: "; cin >> num2; if (num1 > num2) { cout << "Larger number is: " << num1 << endl; } else { cout << "Larger number is: " << num2 << endl; } return 0; } Sample output: Enter first number: 23 Enter second number: 45 Larger number is: 45 Explanation: The program starts by including the necessary header file iostream which contains the standard input/output library in C++. using namespace std; statement is used to avoid typing std:: before standard library objects. Two integer variab...
This blog is about providing theory as well as simple executable codes of different programming languages such as java, C, C++, and web programming, etc. This blog will be helpful to the IT students to learn about programming.