-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFizzBuzz
34 lines (29 loc) · 898 Bytes
/
FizzBuzz
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
/*Aamer Saleem Mohammed*/
using System;
namespace FizzBuzz
{
class Program
{
static void Main(string[] args)
{
for (int i = 1; i < 101; i++)
{
//If-else statement arrangement should be noticed
//Alteration in the statements messes up logic
if (i % 3 == 0 && i % 5 == 0) //Multiples of 3 and 5 prints FizzBuzz
{
Console.WriteLine("FizzBuzz at " + i + "\n");
}
else if (i % 3 == 0)
{
Console.WriteLine("Fizz at "+i+"\n");//Multiples of 3 prints Fizz
}
else if (i % 5 == 0)
{
Console.WriteLine("Buzz at " + i + "\n");//Multiples of 5 prints Buzz
}
}
Console.ReadLine();
}
}
}