From 91cd2a87cf2ee837f4ce82097c4c7153861ca8cb Mon Sep 17 00:00:00 2001
From: Jakub Walas <s204451@student.pg.edu.pl>
Date: Mon, 31 Mar 2025 08:00:13 +0000
Subject: [PATCH] Upload New File

---
 lab6/lab6zad3.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 lab6/lab6zad3.c

diff --git a/lab6/lab6zad3.c b/lab6/lab6zad3.c
new file mode 100644
index 0000000..a9ea16e
--- /dev/null
+++ b/lab6/lab6zad3.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <math.h>
+#include <pred.h>
+int czy(float R, float M) {
+if(R<=0 || M<=0){return 0;}
+return 1;
+}
+
+float pred(float M, float R){
+    float v, G=6.674;
+    v=sqrt((20000000000*M*G)/R);
+    return v;
+}
+
+int main(){
+    int c;
+    float M,R,v;
+    printf("Podaj mase planety liczb podawana x*10^24\n");
+    scanf("%f",&M);
+    printf("Podaj srednice planety liczba podawana w kilometrach\n");
+    scanf("%f",&R);
+    c =czy(R,M);
+    if(c==0){
+       printf("Dane niepoprawne\n");
+       return 0;
+    }
+    v=pred(M,R);
+    printf("Predkosc ucieczki wynosi %.5f\n",v);
+}
-- 
GitLab