C++ Program to find Average of two numbers
c++ program for how to find average of two numbers
by Krishna viswambharan
Posted on 20 Jul 2018 Category: C plus plus
Edited on 26 Jul 2018
Average of two numbers
This section explains a simple c++ program to read two numbers from the keyboard and display their average on the screen. Source code and output for the program is shown below.
using namespace std;
cout<”Enter the first number :”;
cin>>n1; //Read numbers from keyboard
cout<”Enter the second number :”;
NOTE: some old versions of c++ use header file <iostream.h>. so we should use iostream.h if the compiler does not support ANSI C++ features.
Latest posts in C plus plus