From b1f2c077b6b9c73e29c180759b54149c662564bb Mon Sep 17 00:00:00 2001 From: nyosic Date: Mon, 5 May 2025 14:47:45 +0200 Subject: [PATCH] ni --- .vscode/settings.json | 5 +++++ 4-Warunki/4/main.cpp | 20 ++++++++++++++++++++ 5-Petla/1/main.cpp | 28 ++++++++++++++++++++++++++++ 5-Petla/2/main.cpp | 16 ++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 4-Warunki/4/main.cpp create mode 100644 5-Petla/1/main.cpp create mode 100644 5-Petla/2/main.cpp diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0cba2e6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "iostream": "cpp" + } +} \ No newline at end of file diff --git a/4-Warunki/4/main.cpp b/4-Warunki/4/main.cpp new file mode 100644 index 0000000..e0827e4 --- /dev/null +++ b/4-Warunki/4/main.cpp @@ -0,0 +1,20 @@ +//napisz program ktory sprawdza czy podana liczba jest liczba parzysta + +#include + +using namespace std; + +int main() { + int liczba; + + cout << "Podaj liczbe: "; + cin >> liczba; + + if(liczba % 2 == 0) { + cout << "Liczba " << liczba << " jest parzysta." << endl; + } else { + cout << "Liczba " << liczba << " jest nieparzysta." << endl; + } + + return 0; +} \ No newline at end of file diff --git a/5-Petla/1/main.cpp b/5-Petla/1/main.cpp new file mode 100644 index 0000000..ad292cf --- /dev/null +++ b/5-Petla/1/main.cpp @@ -0,0 +1,28 @@ +/* +petla for +for (stan poczatkowy, warunek koncowy, zmiana stanu) { + // instrukcje +} + +napisz program który wypisze liczby od 1 do 50 a następnie od 50 do 1 +*/ + +#include + +using namespace std; + +int main() { + int i = 1; + cout << "Od 1 do 50: "; + for(int i = 1; i <= 50; i++) { + cout << i << " "; + } + cout << "\n\n"; + cout << "Od 50 do 1: "; + for(int i = 50; i >= 1; i--) { + cout << i << " "; + } + cout << endl; + + return 0; +} \ No newline at end of file diff --git a/5-Petla/2/main.cpp b/5-Petla/2/main.cpp new file mode 100644 index 0000000..934fbad --- /dev/null +++ b/5-Petla/2/main.cpp @@ -0,0 +1,16 @@ +//Napisz program który wypisze znaki od a do z + +#include + +using namespace std; + +int main() { + char znak = 'a'; + cout << "Znaki od a do z: "; + for (char i = 'A'; i <= 'Z'; i++) { + cout << i << " "; + } + cout << endl; + + return 0; +} \ No newline at end of file