Note: We need an author for this blog. Willing people contact Us......

Thursday, 17 November 2016

Dev C++, Example 3

#include <iostream>
using namespace std;

int sum(int a, int b=20)
{
  int result;

  result = a + b;
 
  return (result);
}

int main ()
{
   // local variable declaration:
   int a = 100;
   int b = 200;
   int result;

   // calling a function to add the values.
   result = sum(a, b);
   cout << "Total value is :" << result << endl;

   // calling a function again as follows.
   result = sum(a);
   cout << "Total value is :" << result << endl;

   return 0;
}

No comments:

Post a Comment

Contact us

Name

Email *

Message *