From 4dad21e60734450ca08c8deca5ba41f03ed81224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Pluto=20Pr=C4=85dzynski?= <s203561@student.pg.edu.pl> Date: Mon, 3 Mar 2025 08:36:39 +0000 Subject: [PATCH] Lab 2 zadania --- lab2-1.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lab2-1.c diff --git a/lab2-1.c b/lab2-1.c new file mode 100644 index 0000000..6eab680 --- /dev/null +++ b/lab2-1.c @@ -0,0 +1,36 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + +int calk(){ + int x; + printf("Podaj liczbe calkowita:\n"); + scanf("%i", &x); + return x; +} + +float kolo(){ + float r, pole, obw; + printf("Podaj promien kola:\n"); + scanf("%f", &r); + pole = M_PI*r*r; + obw = 2*M_PI*r; + printf("Pole kola wynosi: %.2f\n", pole); + printf("Obwod kola wynosi: %.2f\n", obw); +} + +float c_to_f(){ + float cels, far; + printf("Podaj temperature w st. Celsjusza:\n"); + scanf("%f", &cels); + far = (cels * 1.8) + 32; + return far; +} + +int main(){ + int x = calk(); + printf("Podana liczba wynosi: %i\n", x); + kolo(); + float far = c_to_f(); + printf("Podana tempertura w Fahrenheitach: %.2f", far); +} -- GitLab