ni
This commit is contained in:
parent
e127eab4e5
commit
b1f2c077b6
4 changed files with 69 additions and 0 deletions
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"files.associations": {
|
||||
"iostream": "cpp"
|
||||
}
|
||||
}
|
20
4-Warunki/4/main.cpp
Normal file
20
4-Warunki/4/main.cpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
//napisz program ktory sprawdza czy podana liczba jest liczba parzysta
|
||||
|
||||
#include <iostream>
|
||||
|
||||
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;
|
||||
}
|
28
5-Petla/1/main.cpp
Normal file
28
5-Petla/1/main.cpp
Normal file
|
@ -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 <iostream>
|
||||
|
||||
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;
|
||||
}
|
16
5-Petla/2/main.cpp
Normal file
16
5-Petla/2/main.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
//Napisz program który wypisze znaki od a do z
|
||||
|
||||
#include <iostream>
|
||||
|
||||
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;
|
||||
}
|
Loading…
Add table
Reference in a new issue