Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int sum=0,counter=0,avg,x,y;
- cout << "Input numbers: "; cin >> x >> y;
- for (int i = 0; i <y ; i++)
- {
- if (i%3==0||i%5==0)
- {
- if (x<i && y>i) {
- sum += i;
- counter++;
- }
- }
- }
- avg = sum / counter;
- cout << "The average of multiples is: " << avg << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment