Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,11 @@
int fact(int n) {
if(n<0) {
throw new IllegalArgumentException('Argument less than 0');
}
return n==0 ? 1 : n*fact(n-1);
}
main() {
print(fact(10));
print(fact(-1));
}

View file

@ -0,0 +1,15 @@
int fact(int n) {
if(n<0) {
throw new IllegalArgumentException('Argument less than 0');
}
int res=1;
for(int i=1;i<=n;i++) {
res*=i;
}
return res;
}
main() {
print(fact(10));
print(fact(-1));
}