412. Fizz Buzz Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output "Fizz" instead of the number and for the multiples of five output "Buzz". For numbers which are m…
public class FizzBuzz { static int start = 1; static int end = 100; public static void main(String[] args) { for(int number=start; number<=end; number++) { StringBuffer outStr = new StringBuffer(); if(number%3 == 0) outStr.append("Fizz"); if(…
g :: Int -> Int -> Int -> String g n 0 0 = "FizzBuzz" g n 0 _ = "Fizz" g n _ 0 = "Buzz" g n _ _ = show n f :: Int -> String f n = g n (n `mod` 3) (n `mod` 5) main = print $ map f [1..100] -- ["1","2…