From 60744a93dd32a9a10f6869de55de74cae96051c3 Mon Sep 17 00:00:00 2001 From: Sandro Welte Date: Thu, 8 Feb 2024 19:10:23 +0100 Subject: [PATCH] added kg to ton converter --- src/convert_kg_to_ton.c | 6 ++++++ src/convert_kg_to_ton.h | 13 +++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/convert_kg_to_ton.c create mode 100644 src/convert_kg_to_ton.h diff --git a/src/convert_kg_to_ton.c b/src/convert_kg_to_ton.c new file mode 100644 index 0000000..51cea7a --- /dev/null +++ b/src/convert_kg_to_ton.c @@ -0,0 +1,6 @@ + +#include "convert_kg_to_ton.h" + +double kg_to_tons(double kilograms) { + return kilograms / 1000.0; // 1 ton = 1000 kilograms +} diff --git a/src/convert_kg_to_ton.h b/src/convert_kg_to_ton.h new file mode 100644 index 0000000..01f9369 --- /dev/null +++ b/src/convert_kg_to_ton.h @@ -0,0 +1,13 @@ + +#ifndef THEADMIRALS_CONVERT_KG_TO_TON_H +#define THEADMIRALS_CONVERT_KG_TO_TON_H + + + + +double kg_to_tons(double kilograms); + + + + +#endif //THEADMIRALS_CONVERT_KG_TO_TON_H