tcc/ASP.NET/Controllers/SimulationController.cs

33 lines
780 B
C#
Raw Normal View History

using Microsoft.AspNetCore.Mvc;
using TCC.Services;
namespace TCC.Controllers
{
[ApiController]
[Route("simulation")]
public class SimulationController : ControllerBase
{
public SimulationController()
{
}
[HttpGet("harmonic-progression")]
public async Task<IActionResult> GetHarmonicProgression([FromQuery] int n)
{
float sum = 0;
for (int i = 1; i <= n; i++)
{
sum += 1.0f / i;
}
return Ok(sum);
}
2023-10-29 22:01:13 +00:00
[HttpGet("json")]
public async Task<IActionResult> GetHarmonicProgression([FromQuery] int n)
{
return Ok(new { message = "Hello World!" });
}
}
}