FizzBuzz Solution(C#)


  • 0
    V
    public class Solution {
            private void btnFizzBuzz_Click(object sender, EventArgs e){
            String mess = "";
            int j = 100;
            int i = 1;
            for (i = 1; i < j; i++)
            {
                mess += i.ToString();
                if (i % 3 == 0)
                {
                    mess += "Fizz";
                }
               if (i % 5 == 0)
                { mess += "Buzz"; }
    
                mess += ",";
    
                };
        }
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.