Update verifica_1/esercizio3.cpp
This commit is contained in:
parent
80d7295c60
commit
3a3fc4f3e3
|
@ -1,24 +1,24 @@
|
||||||
/*
|
/*
|
||||||
AUTORE: Manuel Vichi
|
AUTORE: Manuel Vichi
|
||||||
|
Esercizio 3
|
||||||
*/
|
*/
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
int main(void) {
|
int main(void) {
|
||||||
unsigned int numero, esponente, potenza = 0, moltiplicazione = 0;
|
unsigned int numero, esponente, potenza = 0, moltiplicazione = 0;
|
||||||
cout << "Inserisci un numero: ";
|
cout << "Inserisci un numero: ";
|
||||||
cin >> numero;
|
cin >> numero;
|
||||||
cout << endl;
|
cout << endl;
|
||||||
cout << "Inserisci un esponente per la potenza di 2: ";
|
cout << "Inserisci un esponente per la potenza di 2: ";
|
||||||
cin >> esponente;
|
cin >> esponente;
|
||||||
cout << endl;
|
cout << endl;
|
||||||
// Moltiplicazione: Calcolo della potenza
|
// Moltiplicazione: Calcolo della potenza
|
||||||
for (int temp = 0; temp < esponente; temp++) {
|
for (int temp = 0; temp < esponente; temp++) {
|
||||||
potenza = potenza + esponente;
|
potenza = potenza + esponente;
|
||||||
}
|
}
|
||||||
for (int temp = 0; temp < potenza; temp++) {
|
for (int temp = 0; temp < potenza; temp++) {
|
||||||
moltiplicazione = moltiplicazione + numero;
|
moltiplicazione = moltiplicazione + numero;
|
||||||
}
|
}
|
||||||
cout << "Risultato Moltiplicazione: " << moltiplicazione << endl;
|
cout << "Risultato Moltiplicazione: " << moltiplicazione << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue