I would like for someone to help me by telling me what code i should use in case the input number turns out to be for the secound if or third if, if the used doesnt put the right amount (73-77) then id like the user to be able to type in a new value i can use... how do i do that please
namespace test { class Program {
public static int FahrToCels(int fahr)
{
int cel = (fahr - 32) * 5 / 9;
return cel;
}
static void Main(string[] args)
{
Console.WriteLine("Skrive in Temperaturen: ");
int fahrenheit = int.Parse(Console.ReadLine());
int celsius = FahrToCels(fahrenheit);
Console.Write("Presifs any key to continue . . .");
Console.ReadKey(true);
do
if (celsius >= 73 && celsius <= 77)
{
Console.WriteLine("now it works ");
}
else if (celsius < 72)
{
Console.WriteLine("");
}
else if (celsius > 77)
{
Console.WriteLine("");
}
while (true);
}
}
}
Aucun commentaire:
Enregistrer un commentaire