Advertisement
heian

Untitled

Oct 24th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. /**
  6. Se da un vector de numere naturale si un numar natural k.
  7. Sa se afiseze suma numerelor vi din vector cu propr ca i<k.
  8. */
  9.  
  10. int main()
  11. {
  12. float a[11];
  13.  
  14. ///citirea
  15. int i,k;
  16. cin>>k;
  17. for(i=1;i<=10;i++)
  18. cin>>a[i];
  19.  
  20. int s;
  21. s=0;
  22. for(i=1;i<=k;i++)
  23. s = s+a[i];
  24. cout<<s<<"\n";
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement