Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- /**
- Se da un vector de numere naturale si un numar natural k.
- Sa se afiseze suma numerelor vi din vector cu propr ca i<k.
- */
- int main()
- {
- float a[11];
- ///citirea
- int i,k;
- cin>>k;
- for(i=1;i<=10;i++)
- cin>>a[i];
- int s;
- s=0;
- for(i=1;i<=k;i++)
- s = s+a[i];
- cout<<s<<"\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement