Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions WebApplicationLesson1/Controllers/CalkaulatorController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Microsoft.AspNetCore.Mvc;

namespace WebApplicationLesson1.Controllers
{
public class CalculatorController : Controller
{
public string Index(int a = 0, int b = 0, string c = "+")
{
switch (c)
{
case "+":
return $"{a} + {b} = {a + b}";
case "-":
return $"{a} - {b} = {a - b}";
case "*":
return $"{a} * {b} = {a * b}";
case "/":
return $"{a} / {b} = {a / b}";
default:
return "не по кону";
}
}
}
}