first commit!

This commit is contained in:
2025-02-06 12:54:34 +02:00
commit 37f9a3d138
24 changed files with 693 additions and 0 deletions

15
power.c Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
int power(int m, int n);
int main() {
for (int i = 0; i < 10; ++i)
printf("%d %d %d\n", i, power(2, i), power(-3, i));
}
int power(int base, int n) {
int p = 1; /* 0th power of any number */
for (int i = 1; i <= n; ++i)
p *= base;
return p;
}