1#include<iostream>
2int add(int,int);
3int main()
4{
5 using namespace std;
6 int a,b;
7 cout<<"Enter first number: ";
8 cin>>a;
9 cout<<"Enter second number: ";
10 cin>>b;
11 cout<<"Sum = "<<add(a,b);
12}
13int add(int x,int y)
14{
15 return(x+y);
16}
1#include <iostream>
2using namespace std;
3
4//function declaration
5int addition(int a,int b);
6
7int main()
8{
9 int a,b; //to store numbers
10 int add; //to store addition
11
12 //read numbers
13 cout<<"Enter first number: ";
14 cin>>a;
15 cout<<"Enter second number: ";
16 cin>>b;
17
18 //call function
19 add=addition(a,b);
20
21 //print addition
22 cout<<"Addition is: "<<add<<endl;
23
24 return 0;
25}
26
27//function definition
28int addition(int a,int b)
29{
30 return (a+b);
31}
1#include<iostream>
2using namespace std;
3int main()
4{
5 double number1,number2;
6 double sum0;
7 sum=number1+number2;
8 cout<<sum;
9}