#TC1017 #WSQ08 #FunWithNumbers #Functions
In this WSQ we had to create and call functions; this is really useful because you can do an action doing different actions and writting the code in a different way.
In this link you can find my c++ code:
https:/
And here you can see two pictures about my code and the program running:
#WSQ08 #functions #funwithnumbers2.0
here is my code for wsq08
#include <iostream>
using namespace std;
int sum(int a, int b) {
return a+b;
}
int diff(int a, int b) {
return a-b;
}
int product(int a, int b) {
return a*b;
}
int div(int a, int b) {
return a/b;
}
int remainder(int a, int b) {
return a%b;
}
int main(){
int a, b;
cout <<“enter the first value”<<endl;
cin>> (a);
cout <<“enter the second value”<<endl;
cin>> (b);
cout <<“the sum of the numbers is “<<sum (a,b)<< endl;
cout <<“the difference of the numbers is “<<diff (a, b)<< endl;
cout <<“the product of the numbers is “<<product (a, b)<< endl;
cout <<“the integer divition of the numbers is “<<div (a, b)<< endl;
cout <<“the remainder of the numbers is “<<remainder (a, b)<< endl;
return 0;
}