From c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:08:27 +0200 Subject: add: graphs et rushs --- graphs/piscine/my_pow/my_pow.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 graphs/piscine/my_pow/my_pow.c (limited to 'graphs/piscine/my_pow') diff --git a/graphs/piscine/my_pow/my_pow.c b/graphs/piscine/my_pow/my_pow.c new file mode 100644 index 0000000..f529d87 --- /dev/null +++ b/graphs/piscine/my_pow/my_pow.c @@ -0,0 +1,13 @@ +int my_pow(int a, int b) +{ + if (!a) + return b == 0; + int res = 1; + for (int i = 0; i < b / 2; i++) + { + res *= a * a; + } + if (b % 2) + res *= a; + return res; +} -- cgit v1.2.3