Имеется последовательность чисел a1, a2 , ..., aN . Найти сумму первых из них, произведение которых не превышает заданного числа М. СИ++. #include #include #include
#include #include #include #include using namespace std;
int main(int argc, char* argv[]) {int m;int arr[10]; cout << "input elements " << endl;<br>for ( int i= 0; i < 10; i++ ) cin >> arr[i]; cout << "input m " << endl;<br>cin >> m; cout << "arr = {";<br>for ( int j = 0;j < 10; j++ ) cout << arr[j] << " ";<br>int sum; for ( int k = 0; k < 10; k++ ) if (arr[k]*arr[k+1]<=m) {<br>sum=arr[k]+arr[k+1];break; } cout << "" << endl;<br>cout << "Summa " << " ";<br>cout << sum << endl;;<br>system("pause"); return 0;}