Microsoft Interview Question for Program Managers






Comment hidden because of low score. Click to expand.
1
of 1 vote

Shudnt it be:

int sum(int n)
{
return (0==n)?0:(n%10 + sum(n/10));
}

- Anonymous February 09, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think the function parameter should be "unsigned int" instead of "int".

- Anonymous August 06, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

int sumDigit(int x)
{
int ret = 0;

}

- Anonym April 15, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int sum(int d) {
if(d==0) return;
sum(d/10);
z=z+d%10;
return z;
}

- Giri April 16, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int sum = 0;
while (num != 0)
{
sum += num%10;
num = ceil(num%10)
}

- Eila June 11, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int sum = 0;
while (num)
{
sum += num%10;
num = floor(num/10);
}

- Zaose July 11, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

while(n>1)
{
digit+=n%10;
n=n/10;
}
cout<<digit;

- Anonymous March 04, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

static void Main()
{
int num;
num=999;

Console.WriteLine(sum1(num));


}
public static int sum1(int num)
{
int sum=0;
int i=0;
for(i=0; num>=0;i=num)
{
sum=sum+num%10;
num=num/10;
i=num;
if(num==0)
{
return sum;

}
}
Console.WriteLine("num"+num);
return sum;
}

- use this May 18, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

int sum(int n)
{
return (0==n)?0:(n/10 + sum(n%10));
}

- Ankush Bindlish November 07, 2008 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More