2023-10-27 01:33:28 +00:00
|
|
|
|
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")]
|
2023-10-29 22:03:14 +00:00
|
|
|
|
public async Task<IActionResult> GetJsonResponse()
|
2023-10-29 22:01:13 +00:00
|
|
|
|
{
|
|
|
|
|
return Ok(new { message = "Hello World!" });
|
|
|
|
|
}
|
2023-10-27 01:33:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|