Generation

generate functionFri, 18 Nov 2022

Let's create a program that asks for the temperature of the water and then decides what state it is in. The state can be liquid, steam or ice.

public static void WaterState(int temperature) { string state = ""; if (temperature > 100) { state = "steam"; } else if (temperature < 0) { state = "ice"; } else { state = "liquid"; } Console.WriteLine(state); }

Questions about programming?Chat with your personal AI assistant