how can i get this 123456789
1234 6789
123 789
12 89
1 9



how can i get this 123456789 1234 6789 123 789 ..

Answer / tanvir anwar

int n = 9; // you can use any odd number for similar pattern
int mid = (n+1)/2;
for (int i = 0; i < mid; i++)
{
for (int j = 1; j <= n; j++)
{
if (j <= mid-i || j >= mid+i)
Console.Write({0}, j);
else
Console.Write(" ");
}
Console.WriteLine();
}

Is This Answer Correct ?    10 Yes 2 No

Post New Answer

More C Sharp Interview Questions

What is application c#?

0 Answers  


What is event delegate in c#?

0 Answers  


What is the difference between asp net and c#?

0 Answers  


What is web forms in c#?

0 Answers  


public void A() { int x; x = 8; x *= 4 + 8 / 2; } Given the above code, what is the value of "x"?

8 Answers  






How Is The Dll Hell Problem Solved In .net?

0 Answers   Siebel Systems,


Is c# a backend language?

0 Answers  


How do I create a multilanguage?

0 Answers  


What is difference between C# and VB.NET?

0 Answers   CDC,


What is local function?

0 Answers  


What is the Signification of the "new " keyword in C#? example

0 Answers   Wipro,


write program in C# for palindrome? (aug 2009) write program in C3 for generating below output?(aug 2009) # # # # # # # # # #

4 Answers   TCS,


Categories