Something I haven't often seen in FizzBuzz implementation is a focus on making it flexible and maintainable. I have attempted to create a version that prioritizes these, such as by making it easier to change the conditions and add more conditions. What else could I do to work towards these criteria?
public class V3_ifFunc
{
public static void main(String[] args)
{
String out;
int i;
for(i=0; i<=100; i++)
{
out = "";
if(divisible(i, 3)){
out += "Fizz";
}
if(divisible(i, 5)){
out += "Buzz";
}
if(out.equals("")){
out += Integer.toString(i);
}
System.out.println(out);
}
}
public static boolean divisible(int i, int by)
{
if(i%by==0){
return true;
}else{
return false;
}
}
}