zad3
gorazd
c_cpp
10 months ago
368 B
3
Indexable
2kolok_SP
#include <iostream>
#include <cctype>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for ( int i = 0; i < n; i++) {
cin>>*(a+i);
}
int ind;
cin>>ind;
if (ind > n)
cout<<0;
else{
int sum = 0;
for ( int i = ind; i < n; i++) {
sum+=*(a+i);
}
cout<<sum;
}
}Editor is loading...
Leave a Comment