Skip to content

Commit e70abc1

Browse files
committed
first code commit
1 parent 7c6b086 commit e70abc1

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

Diff for: .gitignore

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
28+
29+
# Executables
30+
*.exe
31+
*.out
32+
*.app
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <iostream>
2+
3+
using namespace std;
4+
5+
int main()
6+
{
7+
cout<<"Enter the number of natural numbers to sum up"<<endl;
8+
9+
int n;
10+
cin>>n;
11+
12+
int sum, i;
13+
14+
sum = 0;
15+
16+
for(i=1;i<=n;i++)
17+
{
18+
sum +=i;
19+
}
20+
21+
cout<<"The sum of the "<<n<<" natural numbers is "<<sum<<endl;
22+
23+
return 0;
24+
}

0 commit comments

Comments
 (0)