Facebook
From Ivory Echidna, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 75
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int a, b,suma=0,c;
  5. int main()
  6. {
  7.     start:
  8.     cout << "Podaj zakres liczb:" << endl;
  9.     cin>>a;
  10.     cin>>b;
  11.     while (a <=b )
  12.     {
  13.       if (a%2==0)
  14.       {
  15.           suma=suma+a;
  16.           a+=1;
  17.       }
  18.       else
  19.       {
  20.           a+=1;
  21.       }
  22.     }
  23.     cout<<"Suma liczb parzystych: "<<suma<<endl;
  24.     return 0;
  25. }