Пример #1
0
        public IActionResult Index(FizzandBuzz input)
        {
            //Input numbers
            //int firstNum = input.FirstNum;
            //int secondNum = input.SecondNum;

            for (int loop = input.FirstNum; loop <= input.SecondNum; loop++)
            {
                int fizz = loop % 3;
                int buzz = loop % 5;

                if (fizz == 0 && buzz == 0)
                {
                    input.Message += " FizzBuzz";
                }
                else if (fizz == 0)
                {
                    input.Message += " Fizz";
                }
                else if (buzz == 0)
                {
                    input.Message += " Buzz";
                }
                else
                {
                    input.Message += $" {loop}";
                }
            }

            return(View(input));
        }
Пример #2
0
        //GET
        public IActionResult Index()
        {
            //Object initialization
            var model = new FizzandBuzz();

            return(View(model));
        }