English

Write C++ program to add two integer numbers by using function call by value. - Computer Science 1

Advertisements
Advertisements

Question

Write C++ program to add two integer numbers by using function call by value.

Code Writing
Advertisements

Solution

#include<iostream.h>
#include<conio.h>
int add(int a, int b);
int main()
{
int x, y, ans;
cout<<"Enter two numbers";
cin>>x>>y;
ans=add(x,y);
cout<<"Addition="<<ans;
getch();
return 0;
}
int add(int a, int b)
{
return a+b;
}
shaalaa.com
  Is there an error in this question or solution?
2024-2025 (March) Official
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×