Advertisement
informaticage

Untitled

Jun 3rd, 2021
1,115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int multipli_3(int a, int b) {
  5.   int m = 0;
  6.   for(int i = a; i <= b; i++) {
  7.     if(i % 3 == 0) m ++;
  8.   }
  9.   return m;
  10. }
  11.  
  12. int main() {
  13.   int a, b;
  14.   cout << "Inserire a, b: ";
  15.   cin >> a >> b;
  16.   cout << "Numero mutipli di 3 nell'intervallo a, b: " << multipli_3(a, b);
  17.   return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement