Skip to main content
FREE Mock interview & resume review with Sumit. Free right now, no payment needed.Book a slot

Check if two numbers are twin primes

BackEasyPrime NumbersQ4
Check if two numbers are twin primes
Two prime numbers are called twin primes if they differ by 2. Write a function to check if two given numbers are twin primes.
Test Cases5 test cases

Test Cases:

Showing 2 of 3 sample test cases
Test Case 1
Input:
{
  "a": 3,
  "b": 5
}
Expected Output:
true
Test Case 2
Input:
{
  "a": 5,
  "b": 7
}
Expected Output:
true
+1 more sample test cases (will be validated when you run code)
Sign in to save your progress and mark problems as solved.
Code Editor

Loading editor...

Problem discussion

(0)

Join the discussion — login to comment and help other developers.

Login to comment