From 0bd99aceb798484e0c597ad784c20ecd8a897124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20=C5=9Amie=C5=BCewski?= <s204529@student.pg.edu.pl> Date: Mon, 24 Mar 2025 09:00:30 +0000 Subject: [PATCH] Upload New File --- lab05/main2.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lab05/main2.c diff --git a/lab05/main2.c b/lab05/main2.c new file mode 100644 index 0000000..4e2ae66 --- /dev/null +++ b/lab05/main2.c @@ -0,0 +1,20 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + +int main(){ + printf("Podaj mase: "); + float mass=0; + scanf("%f",&mass); + printf("Podaj skladowe wektora: "); + float vel[3]; + char vec[3]={'x','y','z'}; + scanf("%f %f %f", &vel[0],&vel[1],&vel[2]); + float ped=0; + for(int i=0; i<=2; i++){ + printf("%c skladowa pedu: %f\n", vec[i], mass*vel[i]); + ped+=((mass*vel[i])*(mass*vel[i])); + } + printf("Calkowity ped wynosi: %f\n",sqrt(ped)); + return 0; +} -- GitLab