Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
60
Task/General-FizzBuzz/C-sharp/general-fizzbuzz.cs
Normal file
60
Task/General-FizzBuzz/C-sharp/general-fizzbuzz.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
|
||||
public class GeneralFizzBuzz
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
|
||||
int limit;
|
||||
|
||||
string iString;
|
||||
string jString;
|
||||
string kString;
|
||||
|
||||
Console.WriteLine("First integer:");
|
||||
i = Convert.ToInt32(Console.ReadLine());
|
||||
Console.WriteLine("First string:");
|
||||
iString = Console.ReadLine();
|
||||
|
||||
Console.WriteLine("Second integer:");
|
||||
j = Convert.ToInt32(Console.ReadLine());
|
||||
Console.WriteLine("Second string:");
|
||||
jString = Console.ReadLine();
|
||||
|
||||
Console.WriteLine("Third integer:");
|
||||
k = Convert.ToInt32(Console.ReadLine());
|
||||
Console.WriteLine("Third string:");
|
||||
kString = Console.ReadLine();
|
||||
|
||||
Console.WriteLine("Limit (inclusive):");
|
||||
limit = Convert.ToInt32(Console.ReadLine());
|
||||
|
||||
for(int n = 1; n<= limit; n++)
|
||||
{
|
||||
bool flag = true;
|
||||
if(n%i == 0)
|
||||
{
|
||||
Console.Write(iString);
|
||||
flag = false;
|
||||
}
|
||||
|
||||
if(n%j == 0)
|
||||
{
|
||||
Console.Write(jString);
|
||||
flag = false;
|
||||
}
|
||||
|
||||
if(n%k == 0)
|
||||
{
|
||||
Console.Write(kString);
|
||||
flag = false;
|
||||
}
|
||||
if(flag)
|
||||
Console.Write(n);
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue