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
| fizz(numero: Inteiro) = escolha numero | |
| caso n se n mod 3 == 0 => "fizz" | |
| caso _ => "{numero}" | |
| fim | |
| buzz(numero: Inteiro) = escolha numero | |
| caso n se n mod 5 == 0 => "buzz" | |
| caso _ => "{numero}" | |
| fim |
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
| var numero := leia_inteiro | |
| var r :="" | |
| enquanto numero>0 faca | |
| n = numero/2 | |
| resto = numero - n*2 | |
| r := r + resto.toString | |
| numero := n | |
| fim | |
| escreva r.inverta |
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
| package main.scala | |
| import math.{ abs, min } | |
| import Int.MaxValue | |
| case class Map(val airports: Seq[(Int, Int)] = Seq(), val clouds: Seq[(Int, Int)] = Seq()) { | |
| def addAirports(coordinates: Seq[(Int, Int)]) = Map(airports ++ coordinates, clouds) | |
| def airportAt(coordinate: (Int, Int)) = airports.exists(_ == coordinate) |
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
| package main.scala | |
| import math.{ abs, min } | |
| import Int.MaxValue | |
| case class Map(val airports: Seq[(Int, Int)] = Seq(), val clouds: Seq[(Int, Int)] = Seq()) { | |
| def addAirports(coordinates: Seq[(Int, Int)]) = Map(airports ++ coordinates, clouds) | |
| def airportAt(coordinate: (Int, Int)) = airports.exists(_ == coordinate) |