Quick actions

cmd+k|ctrl+k

Navigation

Languages

lab5 6

Snippet info

Language

Cpp

Visibility

public

Author

enifmankalinan

Created

2018-12-03T21:38:05Z

Updated

2018-12-03T21:38:05Z

#include <iostream>
using namespace std;

int main() {
	
	setlocale(LC_ALL, "");
	
	double a;
	double x = 0;
	double n = 2;
	cout << "Введите число а (1 < a <= 1.5)" << endl;
	cin >> a;

	if (a > 1 && a <= 1.5)
	{
		for (float i = 0; i <= a; i += 0.2)
		{
			x = x + (1 + 1 / n);
			n++;
			if (x >= a) {
				cout << x << "   ";
			}
			else {
				break;
			}
		
		}
	}
	else
		cout << "Неправильный ввод!" << endl;
		
	return 0;
}
INFO