Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exercicios semana 23, aula 74 #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions semana23/exercicios-aula74/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
### Exerícios aula 74
## 1.a
~~~typescript
const exercice1=(n: number): void=>{
if(n >= 0){
exercice1(n-1)
console.log(n)
}
}
~~~
## 1.b
~~~typescript
const exercice1=(n: number): void=>{
if(n >= 0){
console.log(n)
exercice1(n-1)
}
}
~~~
## 2.
~~~typescript
const exercice2=(n: number): number=>{
if(n <= 1 ){
return 1
}
return exercice2(n-1) + n
}
~~~
## 3.
~~~typescript
const exercice3=(array: any[], index = 0): void =>{
if(index < array.length){
console.log(array[index])
index ++
exercice3(array, index)
}
}
~~~
69 changes: 69 additions & 0 deletions semana23/exercicios-aula74/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions semana23/exercicios-aula74/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "exercicios-aula74",
"version": "1.0.0",
"description": "exercicios da aula 74, da semana 23",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "clear && ts-node ./src/index.ts"
},
"author": "OsmanRodrigues",
"license": "ISC",
"dependencies": {
"@types/node": "^14.6.0",
"ts-node": "^9.0.0",
"typescript": "^4.0.2"
}
}
24 changes: 24 additions & 0 deletions semana23/exercicios-aula74/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const exercice1=(n: number): void=>{
if(n >= 0){
console.log(n)
exercice1(n-1)
}
}

const exercice2=(n: number): number=>{
if(n <= 1 ){
return 1
}

return exercice2(n-1) + n
}

const exercice3=(array: any[], index = 0): void =>{
if(index < array.length){
console.log(array[index])
index ++
exercice3(array, index)
}
}

exercice3(['a','b','c', 'd'])
14 changes: 14 additions & 0 deletions semana23/exercicios-aula74/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"outDir": "build",
"sourceMap": true,
"target": "es6",
"module": "commonjs",
"esModuleInterop": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}