Advertisement
Guest User

Untitled

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