PL2023/TPC6/example1

23 lines
307 B
Text
Raw Permalink Normal View History

2023-03-30 16:52:55 +01:00
/* factorial.p
-- 2023-03-20
-- by jcr
*/
int i;
// Função que calcula o factorial dum número n
function fact(n){
int res = 1;
while res > 1 {
res = res * n;
res = res - 1;
}
}
// Programa principal
program myFact{
for i in [1..10]{
print(i, fact(i));
}
}