From 0e670feaf5b5268507367b21ed9c5af8506dbb30 Mon Sep 17 00:00:00 2001 From: Sandro Welte Date: Thu, 8 Feb 2024 20:23:49 +0100 Subject: [PATCH] added ton to megaton converter --- src/convert_ton_to_mt.c | 7 +++++++ src/convert_ton_to_mt.h | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/convert_ton_to_mt.c create mode 100644 src/convert_ton_to_mt.h diff --git a/src/convert_ton_to_mt.c b/src/convert_ton_to_mt.c new file mode 100644 index 0000000..df74434 --- /dev/null +++ b/src/convert_ton_to_mt.c @@ -0,0 +1,7 @@ + +#include "convert_ton_to_mt.h" + + +double tons_to_megatons(double tons) { + return tons / 1000000.0; // 1 megaton = 1,000,000 tons +} diff --git a/src/convert_ton_to_mt.h b/src/convert_ton_to_mt.h new file mode 100644 index 0000000..331c20b --- /dev/null +++ b/src/convert_ton_to_mt.h @@ -0,0 +1,13 @@ + +#ifndef THEADMIRALS_CONVERT_TON_TO_MT_H +#define THEADMIRALS_CONVERT_TON_TO_MT_H + + + + +double tons_to_megatons(double tons); + + + + +#endif //THEADMIRALS_CONVERT_TON_TO_MT_H