Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int a;
  4. int n=0, S=0;
  5. bool parzysta(int a){
  6.     if (a%2==0){
  7.         n++;
  8.         return true;
  9.     }else{
  10.         n=0;
  11.         return false;
  12.     }
  13. }
  14. int main(){
  15.     while(!(n==2)){
  16.         cout<<"Podaj liczbe naturalna = ";
  17.         cin>>a;
  18.         parzysta(a);
  19.         S+=a;
  20.     }
  21.     cout<<"Suma = "<<S;
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement