using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace H3OEF2 { class Program { static void Main(string[] args) { // declaratie int lengte, gewicht; double bmi; string uitkomst; // schermkleuren aanpassen Console.ForegroundColor = ConsoleColor.Black; Console.BackgroundColor = ConsoleColor.White; Console.Clear(); // inlezen Console.WriteLine("berekenen van je BMI"); Console.WriteLine(); Console.Write("Geef je gewicht op in kg: "); gewicht = Convert.ToInt32(Console.ReadLine()); Console.Write("Geef je lengte op in cm: "); lengte = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(); Console.Write("Beoordeling: "); // verwerken bmi = ((gewicht / Math.Pow(lengte,2))*10000); if (bmi < 20) { uitkomst = "te laag gewicht"; } else if (bmi < 25) { uitkomst = "normaal gewicht"; } else if (bmi < 30) { uitkomst = "overgewicht"; } else { uitkomst = "zwaarlijvig"; } // resultaat tonen Console.Write("Beoordeling: "); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(uitkomst); Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Black; // wachten op enter Console.WriteLine(); Console.WriteLine("Druk op enter om verder te gaan"); Console.ReadLine(); } } }