-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is an exercise to learn how to use functions.
- Loading branch information
1 parent
13d1ca3
commit 12a3c82
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int uno, dos; | ||
|
||
int suma (int a, int b) | ||
{ | ||
return (a)+(b); | ||
} | ||
int resta (int a, int b) | ||
{ | ||
return (a)+(b); | ||
} | ||
int div (int a, int b) | ||
{ | ||
return (a)/(b); | ||
} | ||
int mult (int a, int b) | ||
{ | ||
return (a)*(b); | ||
} | ||
|
||
int main() | ||
{ | ||
cout << "Ingrese dos números enteros positivos" <<endl; | ||
cout << "Número 1" << endl; | ||
cin>> uno; | ||
cout << "Número 2" << endl; | ||
cin>> dos; | ||
if (uno < 0 || dos < 0) | ||
cout <<"Sólo números enteros positivos."; | ||
cout<< suma (uno, dos); | ||
return 0; | ||
} |