Skip to content

Commit 4ce8532

Browse files
committed
Added 38A - Army.cpp
1 parent 6c5cab6 commit 4ce8532

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

38A - Army.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
// Code Written By: Vikash Patel
5+
6+
int main()
7+
{
8+
int n;
9+
cin>>n;
10+
int arr[n-1];
11+
for(int i=0;i<n-1;i++)
12+
{
13+
cin>>arr[i];
14+
}
15+
int a,b;
16+
cin>>a>>b;
17+
int ans=0;
18+
for(int i=a-1;i<b-1;i++)
19+
{
20+
ans+=arr[i];
21+
}
22+
cout<<ans<<endl;
23+
}
24+
25+
26+
27+
28+
29+
30+

0 commit comments

Comments
 (0)