forked from abhishekdoifode1/Hacktoberfest2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variableFizzBuzz.cs
35 lines (33 loc) · 925 Bytes
/
variableFizzBuzz.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
using System;
namespace variableFizzBuzz
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please enter a number for fizz:");
int x = int.Parse(Console.ReadLine());
Console.WriteLine("Please enter a number for buzz:");
int y = int.Parse(Console.ReadLine());
for (int i = 1; i < 101; i++)
{
if (i % x == 0 && i % y == 0)
{
Console.WriteLine("fizzBuzz");
}
else if (i % x == 0)
{
Console.WriteLine("fizz");
}
else if (i % y == 0)
{
Console.WriteLine("buzz");
}
else
{
Console.WriteLine(i);
}
}
}
}
}