Advertisement
Guest User

Guerrucci gay capo degli ebrei

a guest
Oct 21st, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int k, n;
  9.     int nMultipli = 0;          // Gli n numeri multipli di k
  10.  
  11.     cout << "Inserisci k: ";
  12.     cin >> k;
  13.  
  14.     while (k < 1)
  15.     {
  16.         cout << "Errore, k deve essere maggiore di 0." << endl;
  17.         cout << "Inserisci k: ";
  18.         cin >> k;
  19.     }
  20.  
  21.     do
  22.     {
  23.         cout << "Inserisci n: ";
  24.         cin >> n;
  25.         while (n == 0)
  26.         {
  27.             cout << "n non puo' essere 0. Immettilo negativo per uscire o positivo per continuare." << endl;
  28.             cout << "Inserisci n: ";
  29.             cin >> n;
  30.         }
  31.         if (n % k == 0)
  32.         {
  33.             nMultipli++;
  34.         }
  35.     } while (n > -1);
  36.  
  37.     cout << "I numeri multipli di " << k << " sono " << nMultipli << endl;
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement