- 2
Sum of first 10 natural numbers
2 Answers
+ 6
#include <iostream>
using namespace std;
int main()
{ int n, sum = 0;
cout << "Enter a positive integer: ";
cin >> n;
for (int i = 1; i <= n; ++i) { sum += i; }
cout << "Sum = " << sum; return 0;
}
+ 3
55.