Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Sum of Natural Numbers using loop
//clang 3.8.0 #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; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
uniq ptr
cv5_class
hw1 Os
Struct memory ordering
Dynamic call
Reference example
general
DESim Example with Hash Table
Unqualified free functions
DESim Example
Please log in to post a comment.