GATE 2014 [Set-3]
November 19, 2023Software-Engineering
November 20, 2023Question 12676 – Control-Statement
Given the pseudocode below for the function remains(), which of the following statements is true about the output, if we pass it a positive integer n > 2?
int remains(int n)
{
int x = n;
for (i=(n-1);i>1;i–) { x = x i;
}
return x;
}
Correct Answer: B
Output is always 0
Output is always 1
Output is 0 only if n is NOT a prime number
Output is 1 only if n is a prime number
None of the above
Subscribe
Login
0 Comments