‹ Back to the paper
With reference to the program code given below, answer the following question: int test(int n) {…
With reference to the program code given below, answer the following question:
int test(int n)
{
if(n == 1) return 0;
for (int i = 2; i <= (int)(Math.sqrt(n)); i++)
if(n % i == 0)
return 0;
return 1;
}
What is the method test() performing?- (i)Prime number/Composite number
- (ii)Armstrong number
- (iii)Palindrome number
- (iv)Perfect number
Answer
No answer yet.
From ISC 2022 Computer Science - Specimen paper (Semester 1), Paper 1, question 27(b).