This repository has been archived by the owner on Jun 16, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c6ed65
commit c1884ad
Showing
5 changed files
with
49 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
esercutazioni/*.out | ||
esercitazioni/*.out | ||
|
Binary file not shown.
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,13 @@ | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
int n; | ||
cin >> n; | ||
do { | ||
cout << n << " "; | ||
n /= 10; | ||
} while (n>0); | ||
cout << endl; | ||
} |
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,22 @@ | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
int a, b; | ||
cin >> a >> b; | ||
|
||
int res = 0; | ||
if (b<a) { // ottimizzazione per minimizzare il numero di iterazioni | ||
a += b; | ||
b = a-b; | ||
a -= b; | ||
} | ||
for (int i=0; i<a; i++) { // prodotto come sequenza di somme di due numeri | ||
res += b; | ||
} | ||
cout << a << " iterazioni" << endl; | ||
|
||
cout << a << " * " << b << " = " << res << endl; | ||
return 0; | ||
} |
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,13 @@ | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
int n; | ||
cin >> n; | ||
while (n>0) { | ||
cout << n%10; | ||
n /= 10; | ||
} | ||
cout << endl; | ||
} |