start king

This commit is contained in:
Your Name
2026-05-02 03:10:01 +02:00
parent 05e167b58a
commit 64ef5c8a7c
8 changed files with 42 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
#include <stdio.h>
#include <stdlib.h>
int recfact(int x){
int y = 1;
if (x==1){
return y;
} else {
return y *= x *recfact(x-1);
}
}
int recfor(int x){
int gaga = 1;
for (int i = 1; i < x;) {
gaga *= i++;
}
return gaga;
}
/*
* i = 1, gaga = 1*2
* i = 2, gaga = 1*2*3 = 6
* i = 3, 1*2*3*4 = 24
*
* wrong loop time condition
* wrong calculation
*
* ---
*
* recursion
*
* forgot to assign, forgot a number (multiplied by 0)
* misunderstood calculation
wel exploren, maar wel naar een doel.
kijken naar auxililiaries.
curiosity wss, leren vragen. leren wat ik niet heb, weten wat ik niet weet.
zoektocht heeft wat sturing nodig.
hoe ik mijn probeer stel/vind
het probleem onderzoeken
limiteer de pogingen
hardware / networking
* * */
int main () {
int i = 6; // we can not handle negative numbers
printf("%d\n", recfor(i));
printf("%d\n", recfact(i));
return 0;
}