Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int summary = 0, amount = 0, temp, a, b;
- bool isEnded = false;
- cout << "Enter a: ";
- cin >> a;
- cout << "Enter b: ";
- cin >> b;
- while (!isEnded) {
- cin >> temp;
- if (temp == 0) {
- isEnded = true;
- } else {
- if (temp >= a && temp <= b) {
- summary += temp;
- amount++;
- }
- }
- }
- cout << "Amount = " << amount << endl << "Summary = " << summary;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement