Algorithm Analysis
To solve the problem, we will use a conditional statement.
Algorithm Implementation
Read the input value of temperature .
scanf("%d", &t);
Depending on the value of , output the corresponding answer.
if (t > 0) printf("Water\n"); else printf("Ice\n");
Java Implementation
import java.util.*; public class Main { public static void main(String[] args) { Scanner con = new Scanner(System.in); int t = con.nextInt(); if (t > 0) System.out.println("Water"); else System.out.println("Ice"); con.close(); } }
Python Implementation
Read the input value of temperature .
t = int(input())
Depending on the value of , output the corresponding answer.
if t > 0: print("Water") else: print("Ice")