-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathFizzstring2.cs
More file actions
64 lines (61 loc) · 1.74 KB
/
Copy pathFizzstring2.cs
File metadata and controls
64 lines (61 loc) · 1.74 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication176
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("FizzString2");
Console.WriteLine("\n");
Console.WriteLine("Enter the number:");
int n = Convert.ToInt32(Console.ReadLine());
string special = "!";
string word = "Fizz";
string word1 = "Buzz";
string word2 = "FizzBuzz";
string number = string.Empty;
int three = 0, five = 0;
if (n % 3 == 0)
{
three++;
}
if (n % 5 == 0)
{
five++;
}
Console.WriteLine("\n");
Console.WriteLine("\n");
Console.WriteLine("\n");
if (three == 1 && five == 0)
{
word = word+ special;
Console.WriteLine("\n");
Console.WriteLine(word);
}
else if (three == 0 && five == 1)
{
word1 = word1 + special;
Console.WriteLine("\n");
Console.WriteLine(word1);
}
else if (three == 1 && five == 1)
{
word2 = word2 + special;
Console.WriteLine("\n");
Console.WriteLine(word2);
}
else
{
number = number + n.ToString() + special;
Console.WriteLine("\n");
Console.WriteLine(number);
}
Console.WriteLine("\n");
Console.ReadLine();
}
}
}