fix nome pasta

This commit is contained in:
Tiago Sousa 2023-03-30 16:47:44 +01:00
parent ca7b5aa84c
commit c4b6c19b09
2 changed files with 39 additions and 0 deletions

22
tpc6/example1 Normal file
View file

@ -0,0 +1,22 @@
/* 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));
}
}

17
tpc6/example2 Normal file
View file

@ -0,0 +1,17 @@
/* max.p: calcula o maior inteiro duma lista desordenada
-- 2023-03-20
-- by jcr
*/
int i = 10, a[10] = {1,2,3,4,5,6,7,8,9,10};
// Programa principal
program myMax{
int max = a[0];
for i in [1..9]{
if max < a[i] {
max = a[i];
}
}
print(max);
}