#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float a, b, h;
cout << "Enter a, b and h: ";
cin >> a >> b >> h;
float x = a;
float y, sum = 0;
int count = 0, count1 = 0;
while (x <= b) {
y = x * pow(cos(x), 2);
cout << "x = " << x << "; y = " << y << endl;
if (y < 0) {
count = count + 1;
}
if (y > 0) {
count1 = count1 + 1;
}
x = x + h;
}
cout << "count y>0: " << count1 << endl;
cout << "count y<0: " << count << endl;
getchar();
getchar();
return 0;
}
Перед публікацією, радимо ознайомиться з правилами!
Знайшли помилку?
Ви можете повідомити про це адміністрацію.
Виділіть текст і натисніть CTRL+Enter