diff --git a/esercitazioni/0_se_multiplo.cpp b/esercitazioni/0_se_multiplo.cpp new file mode 100644 index 0000000..86b2e39 --- /dev/null +++ b/esercitazioni/0_se_multiplo.cpp @@ -0,0 +1,14 @@ +#include +#include + +using namespace std; + +int main() { + int a, b; + cout << "Inserisci primo numero intero positivo: "; + cin >> a; + cout << "Inserisci secondo numero intero positivo: "; + cin >> b; + cout << n%2 << endl; + return 0; +} diff --git a/esercitazioni/1_se_pos-1_se_neg.cpp b/esercitazioni/1_se_pos-1_se_neg.cpp new file mode 100644 index 0000000..8ae4bea --- /dev/null +++ b/esercitazioni/1_se_pos-1_se_neg.cpp @@ -0,0 +1,12 @@ +#include +#include + +using namespace std; + +int main() { + int a; + cout << "Inserisci numero intero: "; + cin >> a; + cout << a/abs(a) << endl; + return 0; +} diff --git a/esercitazioni/5_0_se_pari.cpp b/esercitazioni/5_0_se_pari.cpp new file mode 100644 index 0000000..14c8b51 --- /dev/null +++ b/esercitazioni/5_0_se_pari.cpp @@ -0,0 +1,12 @@ +#include +#include + +using namespace std; + +int main() { + int n; + cout << "Inserisci numero intero: "; + cin >> n; + cout << n%2 << endl; + return 0; +} diff --git a/esercitazioni/5_1_se_pari.cpp b/esercitazioni/5_1_se_pari.cpp new file mode 100644 index 0000000..df7a2a2 --- /dev/null +++ b/esercitazioni/5_1_se_pari.cpp @@ -0,0 +1,12 @@ +#include +#include + +using namespace std; + +int main() { + int n; + cout << "Inserisci numero intero: "; + cin >> n; + cout << abs(n%2-1) << endl; + return 0; +} diff --git a/esercitazioni/a.out b/esercitazioni/a.out index 373c873..16b0c05 100755 Binary files a/esercitazioni/a.out and b/esercitazioni/a.out differ