Previous Next
0 / 15
Module DEMO-33-67DEMO-OOP-33

Prime Check

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Read one integer and print whether it is prime.

Input Format

Input is given as whitespace-separated tokens in this order:

  1. tested number

Output Format

Print the exact report in this order:

  1. Prime

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
2
Prime: YES
Input: tested number = 2.
Key calculation(s): prime = 2 > 1 | for (int divisor = 2; divisor * divisor <= 2; divisor++) { | "Prime: " + prime ? "YES" : "NO" = "Prime: YES".
Output:
Prime: YES
Sample #2
Public sample
17
Prime: YES
Input: tested number = 17.
Key calculation(s): prime = 17 > 1 | for (int divisor = 2; divisor * divisor <= 17; divisor++) { | "Prime: " + prime ? "YES" : "NO" = "Prime: YES".
Output:
Prime: YES

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings