Cisco Systems Interview Question: Please write code to compute ... | Glassdoor

Interview Question

Intern Interview(Student Candidate) San Jose, CA

Please write code to compute x^x without using multiple

Answer

Interview Answer

5 Answers

0

Use two for loops

Interview Candidate on Feb 16, 2011
0

int mul(int x,int y){
int z=0;
while(y!=0){
if((y&1)==1)
z=z+x;
y=y>>1;
x=x<<1;
}
return z;
}

mvl on Aug 2, 2011
1

We can do this by taking the logarithm also

ynk on Apr 1, 2013
0

#include
using namespace std;

int xxx(int x, int val)
{
    if(val > 0)
    {
        int result = 0;

         for(int k=0;k> x;
    // your code goes here
    int answer = xxx(x,x);
    cout << answer;
    return 0;
}

mnmp: code tested with ideone.com on Aug 30, 2015

One or more comments have been removed.
Please see our Community Guidelines or Terms of Service for more information.

Add Answers or Comments

To comment on this, Sign In or Sign Up.