Sunday 11 August 2013

Lecture 143

                Lecture 143
//Procedures and Functions
//Code:
#include <iostream>
#include <conio.h>
using namespace std;
int square(int);    // Prototype 
main ()
{
  int result = 0;
  int number = 0;
  // Getting the input from the user
  cout << " Please enter the number to calculate the square ";
  cin>> number;
  result = square(number);
  cout << "\n The square number is : "<<  result;
  getch();
  return 0;
}
int square(int n)
{
   return n*n;   
}
Output: