★FizzBuzz問題

FizzBuzz問題
using UnityEngine;
using System.Collections;
public class FizzBuzz : MonoBehaviour {
// Use this for initialization
void Start () {
/*
// 繰り返し文
for(int i = 0; i <= 100; i++){
if("条件A"){
} else if("条件B"){
} else if("条件C"){
} else {
}
}
*/
for(int i = 1; i <= 100; i++){
if(i % 3 ==0 && i % 5 == 0)
print("FizzBuzz");
if(i % 3 == 0)
print("Fizz");
else if(i % 5 == 0)
print("Buzz");
else
print(i); }
}
}
Unity Code Memo
他のコースを見る
FizzBuzz問題
using UnityEngine;
using System.Collections;
public class FizzBuzz : MonoBehaviour {
// Use this for initialization
void Start () {
/*
// 繰り返し文
for(int i = 0; i <= 100; i++){
if("条件A"){
} else if("条件B"){
} else if("条件C"){
} else {
}
}
*/
for(int i = 1; i <= 100; i++){
if(i % 3 ==0 && i % 5 == 0)
print("FizzBuzz");
if(i % 3 == 0)
print("Fizz");
else if(i % 5 == 0)
print("Buzz");
else
print(i); }
}
}
★FizzBuzz問題