Editorial
Use a conditional statement to find the sign of the number.
Algorithm realization
Read the input value of .
scanf("%d",&n);
Determine the sign of the number: positive, negative or zero.
if (n > 0) puts("Positive"); else if (n < 0) puts("Negative"); else puts("Zero");
Java realization
import java.util.*; public class Main { public static void main(String []args) { Scanner con = new Scanner(System.in); int n = con.nextInt(); if (n > 0) System.out.println("Positive"); else if (n < 0) System.out.println("Negative"); else System.out.println("Zero"); con.close(); } }
Python realization
Read the input value of .
n = int(input())
Determine the sign of the number: positive, negative or zero.
if n > 0: print("Positive") elif n < 0: print("Negative") else: print("Zero")