A simple C++ program to Print a Number entered by user

// Needs this header file to support the C++ I/O system
#include <iostream.h>
#include <conio.h>

void main()
{
  int n;
  cout<<"Enter a number: ";

// ">>" is extraction operator
// which causes variable on its right to
// be scanned from the input device.
// "cin" is standard input function.

  cin>>n;
  cout<<"The entered number is "<<n;
  getch();
}


OUTPUT:

No comments:

Post a Comment