Advertisement
SergeyPGUTI

7.1.4

Nov 27th, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6.  int SumRange(int *start,int *end)
  7. {
  8.     int sum;
  9.     for (;start<=end;start++)
  10.     {
  11.        sum+=*start;
  12.     }
  13.     return sum;
  14. }
  15.  
  16. int main()
  17. {
  18.     int n;
  19.     cin>>n;
  20.     int *Mas=new int[n];
  21.     for (int i=0;i<n;i++)
  22.     {
  23.         cin>>Mas[i];
  24.     }
  25.     cout<<SumRange(Mas+4,Mas+8);
  26.     return 1;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement