Skip to content

Instantly share code, notes, and snippets.

@enricllagostera
Created October 21, 2014 17:03
Show Gist options
  • Save enricllagostera/e5031248d862511943c5 to your computer and use it in GitHub Desktop.
Save enricllagostera/e5031248d862511943c5 to your computer and use it in GitHub Desktop.
Faça um programa que leia do Inspector uma temperatura em Fahrenheit, converta-a para graus Celsius e escreva o novo valor na tela. A fórmula de conversão de Fahrenheit (F) para Celsius é C = ( ( F - 32 ) * 5 ) / 9. Exemplo: 100 Fahrenheit = 37,77 Celsius.
using UnityEngine;
using System.Collections;
public class ConversorFahrenheit : MonoBehaviour
{
public float tempF;
void Start () {
float tempC = (tempF - 32) * 5 / 9;
print("A temperatura em Celsius é " + tempC);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment