557 views
0 votes
0 votes

What does the following function do?
 

 
int fun(unsigned int n)
{
    if (n == 0 || n == 1)
        return n;

    if (n%3 != 0)
        return 0;

    return fun(n/3);
}

 

  1. Returns 1 when n is multiple of 3, otherwise returns 0
  2. Returns 1 when n is the power of 3, otherwise returns 0
  3. Returns 0 when n is multiple of 3, otherwise returns 1
  4. Returns 0 when n is the power of 3, otherwise returns 1

Please log in or register to answer this question.

Related questions

1 votes
1 votes
1 answer
1
Gurdeep Saini asked Nov 9, 2018
1,817 views
If the bandwidth of a medium is 100 Mbps and round-trip time is 50 microseconds then calculate the sequence bits in Go Back N ARQ flow control policy is applied and frame...
1 votes
1 votes
1 answer
3
Gurdeep Saini asked Nov 9, 2018
2,649 views
Which of the following is not the Application layer protocol in TCP/IP Model?SMTP, FTP, TELNET, POP, MIME, HTTPAFTP, POP, MIME, SMTPBTELNET, HTTPCMIMEDNone of these
0 votes
0 votes
0 answers
4
shiva0 asked Jan 11, 2019
624 views
#include int main() { int i = 1; printf("%d %d %d\n", i++, i++, i); return 0; }