-
Notifications
You must be signed in to change notification settings - Fork 0
/
Class1.cs
41 lines (35 loc) · 854 Bytes
/
Class1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FizzBuzz4
{
public class FizzBuzz
{
public String doFizzBuzz(int upperBound)
{
var value = "";
for(int i=0; i <= upperBound; i++)
{
if (i %5==0 && i%3==0 && i != 0)
{
value += "FizzBuzz";
}
else if(i%5==0 && i != 0)
{
value += "Buzz";
}
else if (i%3==0 && i != 0)
{
value += "Fizz";
}
else
{
value += i.ToString();
}
}
return value;
}
}
}