Skip to content

Commit

Permalink
Create main.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
kerimkuscu committed Apr 16, 2019
1 parent 596deb4 commit b7e4d44
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

using namespace std;

int main(int argc, char** argv) {

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;
}

0 comments on commit b7e4d44

Please sign in to comment.