42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace testtömegindex
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
Console.WriteLine("Testtömeg-index számítás");
|
|
Console.WriteLine("");
|
|
Console.WriteLine("Magasság (cm): ");
|
|
double magassag = Convert.ToInt32(Console.ReadLine());
|
|
Console.WriteLine("Tömeg(kg): ");
|
|
double tomeg = Convert.ToInt32(Console.ReadLine());
|
|
magassag = magassag / 100;
|
|
double bmi;
|
|
bmi = tomeg / (magassag * magassag);
|
|
bmi = Math.Round(bmi * 100.0f) * 0.01;
|
|
Console.WriteLine("Az ön BMI-je = {0}", bmi);
|
|
if (bmi < 18) {
|
|
Console.WriteLine("Túlzottan sovány");
|
|
}
|
|
else if (bmi >= 18 && bmi <= 25) {
|
|
Console.WriteLine("Ideális (egészséges) testsúlyú");
|
|
}
|
|
else if (bmi > 25 && bmi <= 30) {
|
|
Console.WriteLine("Túlsúlyos");
|
|
}
|
|
else if (bmi > 30)
|
|
{
|
|
Console.WriteLine("Túlzottan túlsúlyos");
|
|
}
|
|
|
|
Console.ReadKey();
|
|
}
|
|
}
|
|
}
|