Saturday, August 31, 2013

Function

// How to make Function

#include <stdio.h>
int add(int a, int b)
{
int c = a + b;
printf("Sum of a and b is %d\n",c);
}
int main()
{
int sum;
sum = add(5,4);
return 0;
}


//Video Tutorial for How to Declare Functions



Example 2:

#include <iostream>
using namespace std;
int add(int a, int b)
{
int c = a + b;
cout<<"Sum of a and b is "<<c<<"\n";
}
int main()
{
int sum;
sum = add(5,4);
return 0;
}


1 comment:

  1. This Website is Easy to Learn and usefull and my douts is remove after learn this website.

    ReplyDelete