Interview Question

Software Developer Interview Boston, MA

Ask me to draw a rectangle by stars and numbers as shown

  below 1 12 123 1234 12345 * ** *** **** ***** ******
Answer

Interview Answer

2 Answers

0

for(int i=1;i<=n;i++)
{
for( int j=1; j<=i;j++)
{

write("*") or write(j)
}

writeline();
}

Interview Candidate on Feb 11, 2011
1

Rectangle or triangle ?

Anonymous on Mar 12, 2012

Add Answers or Comments

To comment on this Question, Sign In with Facebook or Sign Up