Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- using namespace std;
- int main()
- {
- int a[100],n, i, suma=0;
- cout<<"Vnesi kolku elementi ima nizata"<<endl;
- cin>>n;
- cout<<"Vnesi gi elementite na taa niza"<<endl;
- for(i=0;i<n;i++)
- {
- cin>>a[i];//tuka gi chitam elementite na nizata
- }
- for(i=0;i<n;i++)
- {
- if(a[i]%2==0)//ako elementot e paren soberi go
- {
- suma+=a[i];//ova e isto kako da sum napishala suma=suma+a[i]
- }
- }
- cout<<"Sumata na parnite elementi vo nizata e "<<suma;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment