#WSQ08 Funfunctions

this is my FUNFUNCTIONS program.

<iostream>

using namespace std;

int sum(int x, int y)

{

return x+y;

}

int dif(int x, int y)

{

return x-y;

}

int mul(int x, int y)

{

return x*y;

}

int div(int x, int y)

{

return x/y;

}

int rem(int x, int y)

{

return x%y;

}

int main()

{

int x, y;

cout<<“Type two integer numbers please.”<<endl;

cin>>x;

cin>>y;

cout<<“The sum of “<<x<<” + “<<y<<” is “<<sum(x,y)<<“.”<<endl;

cout<<“The difference of “<<x<<” – “<<y<<” is “<<dif(x,y)<<“.”<<endl;

cout<<“The product of “<<x<<” * “<<y<<” is “<<mul(x,y)<<“.”<<endl;

cout<<“The integer division of “<<x<<” / “<<y<<” is “<<div(x,y)<<“.”<<endl;

cout<<“The integer remainder of “<<x<<” / “<<y<<” is “<<rem(x,y)<<“.”<<endl;

return 0;

}

CC BY 4.0 #WSQ08 Funfunctions by José Enríquez is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.