Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int days;
- int avgTemperature;
- cout << "How many days are there in your month: ";
- cin >> days;
- cout << "What is the average temperature: ";
- cin >> avgTemperature;
- int monthDays[days];
- for (int i = 1; i <= days; i++) {
- cout << "Enter the temperature for the " << i << " day: " << endl;
- cin >> monthDays[i];
- }
- int degreesCounter = 0;
- for (int i = 1; i <= days; i++) {
- if (monthDays[i] == avgTemperature) {
- degreesCounter ++;
- }
- }
- cout << "The number of days with average temperature is: " << degreesCounter;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment