Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- using namespace std;
- int main(int argc, char** argv)
- {
- int przedzial,sumad=0,sumau=0,sumaw=0;
- cout << "Podaj przedzial ";
- cin >> przedzial;
- for (int i=0; i<=przedzial ; i++)
- {
- if (i % 2 == 0)
- {
- sumad+=i;
- }
- }
- for (int i=0; i>=-przedzial ; i--)
- {
- if (i %2 == 0)
- {
- sumau+=i;
- }
- }
- sumaw=sumad+sumau;
- cout << sumaw;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement