Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Zadanie 1
- #include <iostream>
- using namespace std;
- int main()
- {
- int i;
- for (i = 1; i <= 100; i++)
- {
- cout << i << endl;
- }
- i = 1;
- while (i <= 100)
- {
- cout << i << endl;
- i++;
- }
- i = 1;
- do
- {
- cout << i << endl;
- i++;
- } while (i <= 100);
- }
- Zadanie 2
- #include <iostream>
- using namespace std;
- int main()
- {
- int i;
- int x, y;
- int tymczasowa;
- cout << "Podaj pierwszy kraniec przedzialu" << endl;
- cin >> x;
- cout << "Podaj drugi kraniec przedzialu" << endl;
- cin >> y;
- if (y < x)
- {
- tymczasowa = y;
- y = x;
- x = tymczasowa;
- }
- cout << "\n";
- for (i = x; i <= y; i++)
- {
- if (i % 3 == 0)
- {
- cout << i << " liczba jest podzielna przez 3" << endl;
- }
- else
- {
- cout << i << " liczba nie podzielna przez 3" << endl;
- }
- }
- }
- Zadanie 4
- #include <iostream>
- using namespace std;
- int main()
- {
- int i;
- for (i = 10; i < 100; i++)
- {
- if (i % 4 == 0)
- {
- cout << i << endl;
- }
- }
- }
- Zadanie 5
- #include <iostream>
- using namespace std;
- int main()
- {
- int x,y=0;
- cout << "Podaj przeskok:" << endl;
- cin >> x;
- do
- {
- cout << y << " ";
- y += x;
- } while (y <= 200);
- }
- Zadanie 6
- #include <iostream>
- using namespace std;
- int main()
- {
- int i;
- int x,y=0;
- for (i = 0; i < 10; i++)
- {
- cout << "Podaj kolejno 10 liczb" << endl;
- cin >> x;
- y += x;
- }
- cout << "Suma 10 liczb wynosi: " << y << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment