Advertisement
kuba17ism

Untitled

May 7th, 2020
1,089
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int i, liczba;
  7.     cout << "Podaj liczbe: " << endl;
  8.     cin >> liczba;
  9.  
  10.     cout << "Kolejne parzyste liczby naturalne od 0 do " << liczba << ":" << endl;
  11.     for (i=0;i<=liczba;i++) {
  12.         if (i % 2 == 0) {
  13.             cout << i;
  14.             if (i != liczba && i != liczba-1) {
  15.                 cout << ", ";
  16.             }
  17.         }
  18.     }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement