C++ program using function which accept two integers as an argument and return its sum.

Source Code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include<iostream>
using namespace std;

int sum(int, int);

int main()
{
 int x,y,s;
 cout<<"Enter first number : ";
 cin>>x;
 cout<<"Enter second number : ";
 cin>>y;
 s=sum(x,y);
 cout<<"The sum is : "<<s;

 
 return 0;
}

int sum(int a, int b)
{

 int total;
 total=a+b;
 return total;
}

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

 
Top