Last active
August 29, 2015 14:07
-
-
Save enricllagostera/b51d01fda7d567851c4f to your computer and use it in GitHub Desktop.
Crie um script que conte quantos múltiplos de um número inteiro divisor (definido no Inspector) existem de 0 a 1000 e exiba o resultado ao final.
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
using UnityEngine; | |
using System.Collections; | |
public class ContagemMultiplos : MonoBehaviour | |
{ | |
// editavel no Inspector | |
public int divisor; | |
void Start () | |
{ | |
int multiplos = 0; | |
for (int num = 0; num < 1000; num++) | |
{ | |
if (num % divisor == 0) | |
{ | |
multiplos++; | |
} | |
} | |
print(multiplos); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment