This file contains hidden or 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
| a = 3 | |
| b = 4 | |
| c = 5 | |
| escreva "Escolha um valor para X" | |
| escreva "a, b, c" | |
| x = leia_texto | |
| xis = escolha x | |
| caso "a" => a | |
| caso "b" => b | |
| caso _ => c |
This file contains hidden or 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
| tentativa(palpites: Lista[Inteiro], número: Inteiro, saida: Lista[Texto]): Lista[Texto] | |
| palpite = palpites.cabeça | |
| se palpite <> número então | |
| resp = se palpite < número então | |
| "O número é maior do que {palpite}." | |
| senão | |
| "O número é menor do que {palpite}." | |
| fim | |
| tentativa(palpites.cauda, número, saida + [resp]) | |
| senão |
This file contains hidden or 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
| M = input() | |
| M1, M2, M3 = int(M[-3]),int(M[-2]),int(M[-1]) | |
| M1M3=M1*10+M3 | |
| M1M2=M1*10+M2 | |
| M2M3=M2*10+M3 | |
| M2M1=M2*10+M1 | |
| M3M1=M3*10+M1 | |
| M3M2=M3*10+M2 | |
| print(M1, M2, M3) |
This file contains hidden or 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 fatorial(n): | |
| resultado = 1 | |
| for i in range(2, n+1): | |
| resultado = resultado * i | |
| return resultado | |
| a = int(input("Digite um número")) | |
| print("O fatorial de", a, "é", fatorial(a)) |
This file contains hidden or 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
| # Append | |
| #a = [1, 2, 4, 8] | |
| #a.append(16) | |
| #print(a) #[1, 2, 4, 8, 16] | |
| #b = [] | |
| #for i in range(10): | |
| # x = int(input()) | |
| # b.append(x) |
This file contains hidden or 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
| # Listas | |
| # Lista literal | |
| lista = list(map(int, input("Digite os numeros:").split())) | |
| maior = lista[0] | |
| menor = lista[0] | |
| soma = 0 | |
| for x in lista: | |
| print(x) | |
| if x > maior: |
This file contains hidden or 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 random | |
| numero = random.randint(1, 100) | |
| print("Escolhi um numero entre 1 e 1000.") | |
| print("Tente descobrir.") | |
| palpite = int(input("Qual o seu palpite?")) | |
| contador = 1 | |
| while palpite != numero: |
This file contains hidden or 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 java.io.IOException; | |
| import org.antlr.v4.runtime.ANTLRInputStream; | |
| import org.antlr.v4.runtime.CommonTokenStream; | |
| import org.antlr.v4.runtime.tree.ParseTree; | |
| import org.antlr.v4.runtime.tree.ParseTreeWalker; | |
| public class Principal { | |
| private static ParseTree parse(String programa) { |
This file contains hidden or 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
| Empty file |
This file contains hidden or 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
| class Main { | |
| public static void main(String[] args) { | |
| System.out.println("Hello world!"); | |
| String s = "abc"; | |
| StringBuilder sb = new StringBuilder("`"); | |
| for(char c: s.toCharArray()){ | |
| sb.append(String.format("\\u%04X", (int)c)); | |
| } | |
| sb.append('`'); | |
| System.out.println(sb.toString()); |