In this c# program please convert into c++ program. Source Code: using System; namespace BMI { internal class Program { static void Main(string[] args) { float bmi, m, h, b ; String name; Console.Write("Enter the student name: "); name = Console.ReadLine(); Console.Write("\nEnter the grade level(1-6): "); h = float.Parse(Console.ReadLine()); Console.Write("\nEnter the student Weight(kg): "); m = float.Parse(Console.ReadLine()); Console.Write("\nEnter the height (feet and inches): "); b = float.Parse(Console.ReadLine()); bmi = m / (h * h); Console.WriteLine("\nStudent BMI is: " + bmi); if(bmi < 18.5) { Console.WriteLine("\nStudent is Underweight"); } else if(bmi >= 18.5 && bmi < 25) { Console.WriteLine("\nStudent is Normal Weight"); } else if(bmi >= 25 && bmi < 30) { Console.WriteLine("\nStudent is Overweight"); } else { Console.WriteLine("\nStudent is Obese"); } } } }
In this c#
Source Code:
using System;
namespace BMI
{
internal class Program
{
static void Main(string[] args)
{
float bmi, m, h, b ;
String name;
Console.Write("Enter the student name: ");
name = Console.ReadLine();
Console.Write("\nEnter the grade level(1-6): ");
h = float.Parse(Console.ReadLine());
Console.Write("\nEnter the student Weight(kg): ");
m = float.Parse(Console.ReadLine());
Console.Write("\nEnter the height (feet and inches): ");
b = float.Parse(Console.ReadLine());
bmi = m / (h * h);
Console.WriteLine("\nStudent BMI is: " + bmi);
if(bmi < 18.5)
{
Console.WriteLine("\nStudent is Underweight");
}
else if(bmi >= 18.5 && bmi < 25)
{
Console.WriteLine("\nStudent is Normal Weight");
}
else if(bmi >= 25 && bmi < 30)
{
Console.WriteLine("\nStudent is Overweight");
}
else
{
Console.WriteLine("\nStudent is Obese");
}
}
}
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images