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