summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2022-09-26 10:31:39 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2022-09-26 10:31:39 -0400
commit65e31597fa6bef7ba8263eeb97094d3a829a3ad6 (patch)
treea95214c39e09038871c377c1676dc4bc33a62e7b
parentcef9f7ad1bdc417b82fff594b0b01fc7078a272e (diff)
New tools in format.h
-rw-r--r--format.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/format.h b/format.h
index 2f9c1b4..d0cf95a 100644
--- a/format.h
+++ b/format.h
@@ -20,6 +20,23 @@ const char caps[2][26] = {
'n','o','p','q','r','s','t','u','v','w','x','y','z'}
};
+int pow(int b, int e){
+ int result =1;
+ for (int i = 0; i<e; i++){
+ result *= b;
+ }
+ return result;
+}
+
+float avg(float arr[]){
+ int len = COUNT_OF(arr);
+ float sum = 0;
+ for (int i=0;i<len;i++){
+ sum += arr[i];
+ }
+ return sum/len;
+}
+
// Convert every character to lowercase
char * lower(char *str){
int len = COUNT_OF(str);