Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int catCount, firstGroup = 0, secondGroup = 0, thirdGroup = 0;
- cin >> catCount;
- double food, totalFood = 0;
- for (int i = 0; i < catCount; i++) {
- cin >> food;
- totalFood += food;
- if (food >= 100 && food < 200) {
- firstGroup++;
- }
- else if (food >= 200 && food < 300) {
- secondGroup++;
- }
- else if (food >= 300 && food < 400) {
- thirdGroup++;
- }
- }
- double priceForFoodPerDay = totalFood * 0.01245;
- cout << "Group 1: " << firstGroup << " cats.\n";
- cout << "Group 2: " << secondGroup << " cats.\n";
- cout << "Group 3: " << thirdGroup << " cats.\n";
- printf("Price for food per day: %.2f lv.\n", priceForFoodPerDay);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement