Program to check if given number N is Prime or not
Given a number N, the task is to check if the number is a prime number or not.Check if given number N is Prime or notExamples:Input: N = 11Output: trueExplanation: The number is not divisible by any number, other than 1 and 11 itself.Input: N = 35Output: falseExplanation: Apart from 1 and 35, this number is also divisible by 5 and 7.Naive Approach (using recursion): To check the number is prime or not using recursion follow the below idea:Recursion can also be used to check if a number between 2 to n – 1 divides n. If we…