how can i get this 123456789
1234 6789
123 789
12 89
1 9
Answer Posted / 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 View All Answers
What is asynchronous one-way calls?
What is boxing & unboxing?
Define Abstract Class in C#
What is the purpose of namespace in c#?
What is difference between constants and readonly in c#?
what is full assembly reference
What are the classes contained in a single .NET DLL ?
What is the wildcard character in sql?
How does yield return work c#?
What are anonymous types in c#?
What is linq c#?
What is function c#?
What is default value of decimal c#?
Is it possible to inherit multiple interfaces?
State the top.NET class that everything is derived from?