From d204448bd649afa8e191518e5563c1cdbfd45a90 Mon Sep 17 00:00:00 2001 From: nyosic Date: Fri, 4 Apr 2025 12:47:08 +0000 Subject: [PATCH] Add main.cpp --- main.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..e75c20e --- /dev/null +++ b/main.cpp @@ -0,0 +1,58 @@ +#include +#include +using namespace std; + +bool prime(int x) +{ + if (x < 2) return false; + for (int i=2; i<= sqrt(x); i++) { + if ((x%i) == 0) return false; + } + return true; +} + +int zad1(int n, int i, int x) { + + cout << "podaj n = "; + cin >> n; + + for(int x=1; x<=n; x++) + { + if (prime(x) == true) { + cout << x << " "; + } + } + return 0; +} + +int zad2(int n) { + cout << "Podaj n = "; + cin >> n; + + if (n<0) { + cout << "n nie moze byc mniejsze od 0"; + } + else { + int i = 1; + while (i<=n) + } +} + +int main() { + int n,i,x; + string que; + + cout << "zadanie? = (zad1, zad2, zad3)"; + cin >> que; + + if (que == "zad1") { + zad1(n,i,x); + } + if (que == "zad2") { + zad2(n); + } + + cout << endl; + system("pause"); + return 0; +} \ No newline at end of file