Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <stdlib.h>
- using namespace std;
- int main()
- {
- float h, k;
- cout << "Esercizio 17a pagina 69" << endl << "(C) Cristian Livella 2018" << endl << endl;
- cout << "Inserisci l'altezza iniziale dell'onda h = ";
- cin >> h;
- cout << "Inserisci i chilometri percorsi k = ";
- cin >> k;
- k = floor(k);
- for (int i=0; i<k; i++) {
- if (h>1) {
- h = h/2;
- }
- else {
- h = 0;
- break;
- }
- }
- cout << endl << endl << "L'altezza raggiunta dall'onda dopo aver percorso " << k << " chilometri \212 di " << h << " metri" << endl << endl;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement