0
Beginner Question
Create a function that takes two numbers as arguments and returns their sum.Examples addition(3, 2) â 5 addition(-3, -6) â -9 addition(7, 3) â 10
7 Answers
+ 5
NkO ,
just a general comment to your post:
your questiom seems to be incomplete. the post should include:
> the programming language (to be placed in tags)
> the name of the tutorial and the lesson name (if your question is related to o sololearn tutorial or a code coach exercise)
> a complete task description
> a link that points to your code try
> a description what exactly your issue is, (if possible including an error message)
+ 2
NkO What is your question?
+ 2
NkO Close, that is one way but your problem doesnt follow your solution, something like this should help you:
define addition(first_number, second_number)
add first_number + second_number
return sum
print and call addition(2, 3)
+ 2
def addition(a,b):
return a+b
print(addition (3,2))
+ 1
a = 2
b = 3
sum = 2+ 3
Print(sum)
I just want to know if I am on track with my solution.
+ 1
NkO
in c++ it function can be :-
#include<iostream>
using namespace std;
int func(int x,int y){
return x+y;
}
int main(){
int x,y;
cin>>x>>y;
cout<<func(x,y);