This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Lendo valores no JS via console | |
// http://nodejs.org/api/readline.html#readline_readline | |
var readline = require('readline'); | |
var rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int RST=3; | |
int CLK=9; | |
int DAT=8; | |
int byteEntrada = 0; | |
void setup() { | |
// Entra no espaço "9600" da porta. Esse espaço é PADRÃO. | |
Serial.begin(9600); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Button | |
Turns on and off a light emitting diode(LED) connected to digital | |
pin 13, when pressing a pushbutton attached to pin 2. | |
The circuit: | |
* LED attached from pin 13 to ground | |
* pushbutton attached to pin 2 from +5V |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Authors: Nicolas and Mariane | |
int RST=3; | |
int CLK=9; | |
const int botao = 7; // the number of the pushbutton pin | |
const int ledPin = 2; // the number of the LED pin | |
// variables will change: | |
int buttonState = 0; // variable for reading the pushbutton status | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Authors: Nicolas and Mariane | |
int RST=3; | |
int CLK=9; | |
const int botao = 7; | |
const int ledPin = 2; | |
int buttonState = 0; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int buttonPin = 8; | |
const int ledPin = 2; | |
int buttonState = 0; | |
void setup() { | |
pinMode(ledPin, OUTPUT); | |
pinMode(buttonPin, INPUT); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
Each new term in the Fibonacci sequence is generated by adding the previous two terms. | |
By starting with 1 and 2, the first 10 terms will be: | |
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... | |
By considering the terms in the Fibonacci sequence whose values do not exceed four million, | |
find the sum of the even-valued terms. | |
http://projecteuler.net/problem=2 | |
=end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://projecteuler.net/problem=1 | |
sum = 0 | |
(0..999).each do |n| | |
if n % 3 == 0 || n % 5 == 0 | |
sum += n | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alunos_aprovados = 0 | |
(1..10).each do |n| | |
puts "Aluno #{n} - Aprovado (digite - a) ou Reprovado (digite - r)?" | |
teste = gets.chomp | |
alunos_aprovados += 1 if teste == "a" | |
end | |
if alunos_aprovados >= 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fatorial(n) { | |
if (n == 1) { | |
return 1; | |
} else { | |
return n * fatorial(n - 1); | |
} | |
} | |
console.log(fatorial(5)); |
OlderNewer