mirea-projects/Second term/Industrial programming technologies/5/2.cpp

20 lines
359 B
C++
Raw Normal View History

2024-09-23 23:22:33 +00:00
#include <memory>
#include <numeric>
#include <iostream>
using namespace std;
int main() {
int size;
cin >> size;
unique_ptr<double[]> arr(new double[size]);
for(int index = 0; index < size; index++)
arr[index] = index + 1;
double sum = accumulate(arr.get(), arr.get()+size, 0.0);
cout << sum << endl;
return 0;
}