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
def par_impar(num) | |
if (-1)**num == 1 | |
print "#{num}: par\n" | |
else | |
print "#{num}: impar\n" | |
end | |
end | |
par_impar(1) | |
par_impar(2) |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
//#include <conio.h> | |
struct cli | |
{ | |
char nome[50]; | |
int codigo; | |
struct mov *alugados; |
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
#include <stdio.h> | |
#include <stdlib.h> | |
struct pilha | |
{ | |
int info; | |
struct pilha *prox; | |
}; |
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
def valida_questionario(confirmacao) | |
unless confirmacao.downcase == "sim" || confirmacao.downcase == "nao" | |
print "Responda apenas com Sim ou Nao. " | |
confirmacao = gets.chomp | |
valida_questionario(confirmacao) | |
end | |
if confirmacao.downcase == "nao" | |
print "Qual pergunta esta errada?\n" |
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
#include <cstdio> | |
#include <cstdlib> | |
#include <cstring> | |
#include <iostream> | |
using namespace std; | |
int main(int lWordofArgs, char* pszArgs[]) | |
{ | |
char primeira_letra, segunda_letra; | |
int terceiro_numero; |
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
MAX = 8 | |
def fib(n) | |
return n if (0..1).include? n | |
fib(n-1) + fib(n-2) if n > 1 | |
end | |
def fatorial(n) | |
return n <= 1 ? 1 : n * fatorial(n-1) | |
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
import pymongo | |
from pymongo import Connection | |
connection = Connection('localhost', 27017) | |
db = connection.test | |
names = db.names | |
item = names.find_one() |
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
require 'mongo' | |
include Mongo | |
@client = MongoClient.new('localhost', 27017) | |
@db = @client['test'] | |
@names = @db['names'] | |
item = @names.find_one() |
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
1.upto(100) do |e| | |
puts "#{e} elefante incomoda muita gente" if e == 1 | |
puts "#{e+=1} elefantes #{'incomodam ' * e += 1}muito mais" if e % 2 == 0 | |
puts "#{e+=1} elefantes incomodam muita gente" unless e % 2 == 0 | |
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
<!DOCTYPE html> | |
</html> | |
<head> | |
<title>Administrador de Aplicação</title> | |
</head> | |
<body> | |
<div id=title><h1>Administrador de Aplicação</h1></div> | |
<table title="Estados"> | |
<thead> | |
<tr> |
OlderNewer