Microsoft Interview Question for Software Engineer / Developers






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

http://www.java2s.com/Code/C/Data-Type/Convertanintegertowords.htm

- Karthik February 02, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Please refer Programming interviews exposed.
I feel it has a cleaner and simpler implementation

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

oops... please ignore the prev comment...
I did not read the question correctly...

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

write a function which will print under hundred i.e 0-99 then pass the number two digit then one digit then two digit then one digit into a stack .. when this is done pop them and pass them to printUpToHundred() function which will do the printing stuff and in the main you print lakh,then thousand then hundres take care of the case 1lakh and 2lakhs also

- Hemant Jain February 12, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

write 4 functions.
Unit
Tens
Hundreds
Thousands

Give the input to the thousands. it does a division by 1000 and gets the top 2 numbers and prints it. then it passes the number% 1000 to the hundreds which does likewise till it reaches the units with then prints the units.

- rohit July 31, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

0 is also a special case.
1-19 are special case
tenth place- define all(20,30,40...90)
hundredth place- define all(100,200...)
thousandth place- define all(1000,2000,...)
if(num==0)write zero
else...
{
use the above data stored to display the num.
special case... 'dont display zeroes'.
e.g. 1024- one thousand, twenty, four
e.g. 2318- two thousand, three hundred eighteen.
}

- B August 26, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include <stdio.h>
#include <string.h>

void main()
{
char *unit_words[] = {"zero", "one","two","three","four","five","six","seven","eight","nine"};
char *teen_words[] = {"ten", "eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};
char *ten_words[] = {"error", "error","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};
char hundred[] = " hundred";
char and[] = " and ";
char value_str[50] = "";
int value = 0; /* Integer to be converted */
int digits[] = {0,0,0}; /* Stores digits of value entered */
int i = 0;

printf("Enter an integer less than 1000: ");
scanf("%d",&value);
if(value>=1000)
value =999;
else if(value<1)
value = 1;

while(value>0)
{
digits[i++] = value%10;
value /= 10;
}

if(digits[2] > 0)
{
strcat(strcat(value_str,unit_words[digits[2]]), hundred);
if(digits[1] >0 || digits[0] > 0)
strcat(value_str, and);
}
if(digits[1] > 0)
{
if(digits[1] == 1)
strcat(value_str,teen_words[digits[0]]);
else
{
strcat(value_str,ten_words[digits[1]]);
if(digits[0] > 0)
strcat(strcat(value_str, " "), unit_words[digits[0]]);
}
}
else
if(digits[0] > 0)
strcat(value_str, unit_words[digits[0]]);
printf("\n%s\n", value_str);
}

- jp October 27, 2009 | 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